Add support for JRuby on Windows

This commit is contained in:
Benoit Daloze
2020-01-19 22:56:19 +01:00
parent 0f26fedc26
commit dbac26120b
5 changed files with 16 additions and 14 deletions
+5 -3
View File
@@ -1,3 +1,5 @@
const os = require('os')
const path = require('path')
const core = require('@actions/core')
const io = require('@actions/io')
const tc = require('@actions/tool-cache')
@@ -15,12 +17,12 @@ export async function getAvailableVersions(engine) {
export async function install(platform, ruby) {
const rubyPrefix = await downloadAndExtract(platform, ruby)
core.addPath(`${rubyPrefix}/bin`)
core.addPath(path.join(rubyPrefix, 'bin'))
return rubyPrefix
}
async function downloadAndExtract(platform, ruby) {
const rubiesDir = `${process.env.HOME}/.rubies`
const rubiesDir = path.join(os.homedir(), '.rubies')
await io.mkdirP(rubiesDir)
const url = `${releasesURL}/download/${builderReleaseTag}/${ruby}-${platform}.tar.gz`
@@ -29,5 +31,5 @@ async function downloadAndExtract(platform, ruby) {
const downloadPath = await tc.downloadTool(url)
await tc.extractTar(downloadPath, rubiesDir)
return `${rubiesDir}/${ruby}`
return path.join(rubiesDir, ruby)
}