mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dbac26120b | ||
|
|
0f26fedc26 |
@@ -16,8 +16,6 @@ jobs:
|
||||
# Use various version syntaxes here for testing
|
||||
ruby: [ .ruby-version, 2.3, ruby-2.4, 2.5, ruby-2.6.5, 2.7.0, jruby, truffleruby ]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
ruby: jruby
|
||||
- os: windows-latest
|
||||
ruby: truffleruby
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
@@ -29,8 +29,6 @@ The action works for all [GitHub-hosted runners](https://help.github.com/en/acti
|
||||
| macOS | `macos-latest` |
|
||||
| Windows | `windows-latest` |
|
||||
|
||||
JRuby and TruffleRuby are not yet supported on `windows-latest`.
|
||||
|
||||
The prebuilt rubies are generated by [eregon/ruby-install-builder](https://github.com/eregon/ruby-install-builder)
|
||||
and on Windows by [RubyInstaller2](https://github.com/oneclick/rubyinstaller2).
|
||||
The full list of available Ruby versions can be seen at [versions.json](https://github.com/eregon/ruby-install-builder/blob/metadata/versions.json)
|
||||
|
||||
+13
-12
@@ -1386,17 +1386,17 @@ const core = __webpack_require__(470)
|
||||
async function run() {
|
||||
try {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||
|
||||
let installer
|
||||
if (platform === 'windows-latest') {
|
||||
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||
installer = __webpack_require__(826)
|
||||
} else {
|
||||
installer = __webpack_require__(442)
|
||||
}
|
||||
|
||||
const input = core.getInput('ruby-version')
|
||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
||||
const engineVersions = await installer.getAvailableVersions(engine)
|
||||
const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version)
|
||||
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||
|
||||
const rubyPrefix = await installer.install(platform, ruby)
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
@@ -1425,9 +1425,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
return [engine, version]
|
||||
}
|
||||
|
||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||
if (!engineVersions) {
|
||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
||||
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||
}
|
||||
|
||||
if (!engineVersions.includes(version)) {
|
||||
@@ -1436,9 +1436,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
if (found) {
|
||||
version = found
|
||||
} else {
|
||||
throw new Error(`Unknown version ${version} for ${engine}
|
||||
input: ${input}
|
||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
||||
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
||||
}
|
||||
}
|
||||
@@ -4849,6 +4848,8 @@ function escape(s) {
|
||||
__webpack_require__.r(__webpack_exports__);
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAvailableVersions", function() { return getAvailableVersions; });
|
||||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "install", function() { return install; });
|
||||
const os = __webpack_require__(87)
|
||||
const path = __webpack_require__(622)
|
||||
const core = __webpack_require__(470)
|
||||
const io = __webpack_require__(1)
|
||||
const tc = __webpack_require__(533)
|
||||
@@ -4866,12 +4867,12 @@ async function getAvailableVersions(engine) {
|
||||
|
||||
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`
|
||||
@@ -4880,7 +4881,7 @@ async function downloadAndExtract(platform, ruby) {
|
||||
const downloadPath = await tc.downloadTool(url)
|
||||
await tc.extractTar(downloadPath, rubiesDir)
|
||||
|
||||
return `${rubiesDir}/${ruby}`
|
||||
return path.join(rubiesDir, ruby)
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,17 +5,17 @@ const core = require('@actions/core')
|
||||
async function run() {
|
||||
try {
|
||||
const platform = getVirtualEnvironmentName()
|
||||
const [engine, version] = parseRubyEngineAndVersion(core.getInput('ruby-version'))
|
||||
|
||||
let installer
|
||||
if (platform === 'windows-latest') {
|
||||
if (platform === 'windows-latest' && engine !== 'jruby') {
|
||||
installer = require('./windows')
|
||||
} else {
|
||||
installer = require('./ruby-install-builder')
|
||||
}
|
||||
|
||||
const input = core.getInput('ruby-version')
|
||||
const [engine, version] = parseRubyEngineAndVersion(input)
|
||||
const engineVersions = await installer.getAvailableVersions(engine)
|
||||
const ruby = validateRubyEngineAndVersion(engineVersions, input, engine, version)
|
||||
const ruby = validateRubyEngineAndVersion(platform, engineVersions, engine, version)
|
||||
|
||||
const rubyPrefix = await installer.install(platform, ruby)
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
@@ -44,9 +44,9 @@ function parseRubyEngineAndVersion(rubyVersion) {
|
||||
return [engine, version]
|
||||
}
|
||||
|
||||
function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
function validateRubyEngineAndVersion(platform, engineVersions, engine, version) {
|
||||
if (!engineVersions) {
|
||||
throw new Error(`Unknown engine ${engine} (input: ${input})`)
|
||||
throw new Error(`Unknown engine ${engine} on ${platform}`)
|
||||
}
|
||||
|
||||
if (!engineVersions.includes(version)) {
|
||||
@@ -55,9 +55,8 @@ function validateRubyEngineAndVersion(engineVersions, input, engine, version) {
|
||||
if (found) {
|
||||
version = found
|
||||
} else {
|
||||
throw new Error(`Unknown version ${version} for ${engine}
|
||||
input: ${input}
|
||||
available versions for ${engine}: ${engineVersions.join(', ')}
|
||||
throw new Error(`Unknown version ${version} for ${engine} on ${platform}
|
||||
available versions for ${engine} on ${platform}: ${engineVersions.join(', ')}
|
||||
File an issue at https://github.com/eregon/use-ruby-action/issues if would like support for a new version`)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user