mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4f9058279 | ||
|
|
c40ce85201 | ||
|
|
c68e25cb8c | ||
|
|
95135e9903 | ||
|
|
9f0a9acc35 | ||
|
|
211f6c78ad | ||
|
|
47bbcca04c |
@@ -16,7 +16,7 @@ jobs:
|
||||
matrix:
|
||||
os: [ ubuntu-latest, macos-latest, windows-latest ]
|
||||
# Use various version syntaxes here for testing
|
||||
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.5, 2.7, ruby-head, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
|
||||
ruby: [ 2.2, 2.3, 2.4, 2.5, 2.6.6, 2.7, ruby-head, jruby-9.1, jruby, jruby-head, truffleruby, truffleruby-head ]
|
||||
exclude:
|
||||
- os: windows-latest
|
||||
ruby: truffleruby
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
# setup-ruby
|
||||
|
||||
Note: this action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.
|
||||
Please [update](https://github.com/ruby/setup-ruby/releases/tag/v1.13.0) if you are using `eregon/use-ruby-action`.
|
||||
|
||||
This action downloads a prebuilt ruby and adds it to the `PATH`.
|
||||
|
||||
It is very efficient and takes about 5 seconds to download, extract and add the given Ruby to the `PATH`.
|
||||
@@ -158,8 +155,13 @@ It is recommended to first get your build working on Ubuntu and macOS before try
|
||||
This action follows semantic versioning with a moving `v1` branch.
|
||||
This follows the [recommendations](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md) of GitHub Actions.
|
||||
|
||||
## History
|
||||
|
||||
This action used to be at `eregon/use-ruby-action` and was moved to the `ruby` organization.
|
||||
Please [update](https://github.com/ruby/setup-ruby/releases/tag/v1.13.0) if you are using `eregon/use-ruby-action`.
|
||||
|
||||
## Credits
|
||||
|
||||
The current maintainer of this action is @eregon.
|
||||
Most of the Windows logic is from https://github.com/MSP-Greg/actions-ruby by MSP-Greg.
|
||||
Most of the Windows logic is based on work by MSP-Greg.
|
||||
Many thanks to MSP-Greg and Lars Kanis for the help with Ruby Installer.
|
||||
|
||||
+22
-10
@@ -1058,7 +1058,7 @@ function setupPath(ruby, newPathEntries) {
|
||||
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||
|
||||
if (cleanPath.length !== originalPath.length) {
|
||||
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
||||
console.log('Entries removed from PATH to avoid conflicts with Ruby:')
|
||||
for (const entry of originalPath) {
|
||||
if (!cleanPath.includes(entry)) {
|
||||
console.log(` ${entry}`)
|
||||
@@ -1100,27 +1100,35 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
let versionArray
|
||||
if (bundlerVersion === 'latest') {
|
||||
bundlerVersion = '2'
|
||||
}
|
||||
|
||||
if (rubyVersion.startsWith('2.2')) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 2.2')
|
||||
versionArray = ['-v', '~> 1']
|
||||
bundlerVersion = '1'
|
||||
} else if (/^\d+/.test(bundlerVersion)) {
|
||||
versionArray = ['-v', `~> ${bundlerVersion}`]
|
||||
} else if (bundlerVersion === 'latest') {
|
||||
versionArray = []
|
||||
// OK
|
||||
} else {
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'rubinius') {
|
||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
||||
} else if (bundlerVersion === '1' && engine === 'truffleruby') {
|
||||
if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') {
|
||||
console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`)
|
||||
} else if (engine === 'truffleruby' && bundlerVersion === '1') {
|
||||
console.log(`Using the Bundler version shipped with ${engine}`)
|
||||
} else if (engine === 'rubinius') {
|
||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
||||
} else {
|
||||
await exec.exec(path.join(rubyPrefix, 'bin', 'gem'), ['install', 'bundler', ...versionArray, '--no-document'])
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', `~> ${bundlerVersion}`, '--no-document'])
|
||||
}
|
||||
}
|
||||
|
||||
function isHeadVersion(rubyVersion) {
|
||||
return rubyVersion === 'head' || rubyVersion === 'mingw' || rubyVersion === 'mswin'
|
||||
}
|
||||
|
||||
function getVirtualEnvironmentName() {
|
||||
const platform = os.platform()
|
||||
if (platform === 'linux') {
|
||||
@@ -3436,19 +3444,23 @@ const versions = {
|
||||
"2.4.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.6-1/rubyinstaller-2.4.6-1-x64.7z",
|
||||
"2.4.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.7-1/rubyinstaller-2.4.7-1-x64.7z",
|
||||
"2.4.9": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.9-1/rubyinstaller-2.4.9-1-x64.7z",
|
||||
"2.4.10": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.10-1/rubyinstaller-2.4.10-1-x64.7z",
|
||||
"2.5.0": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.0-2/rubyinstaller-2.5.0-2-x64.7z",
|
||||
"2.5.1": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.1-2/rubyinstaller-2.5.1-2-x64.7z",
|
||||
"2.5.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.3-1/rubyinstaller-2.5.3-1-x64.7z",
|
||||
"2.5.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.5-1/rubyinstaller-2.5.5-1-x64.7z",
|
||||
"2.5.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.6-1/rubyinstaller-2.5.6-1-x64.7z",
|
||||
"2.5.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.7-1/rubyinstaller-2.5.7-1-x64.7z",
|
||||
"2.5.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.8-1/rubyinstaller-2.5.8-1-x64.7z",
|
||||
"2.6.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.0-1/rubyinstaller-2.6.0-1-x64.7z",
|
||||
"2.6.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.1-1/rubyinstaller-2.6.1-1-x64.7z",
|
||||
"2.6.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.2-1/rubyinstaller-2.6.2-1-x64.7z",
|
||||
"2.6.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x64.7z",
|
||||
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z",
|
||||
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z",
|
||||
"2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-1/rubyinstaller-2.6.6-1-x64.7z",
|
||||
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z",
|
||||
"2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z",
|
||||
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
|
||||
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
|
||||
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z"
|
||||
|
||||
@@ -17,7 +17,7 @@ versions = entries.select { |entry|
|
||||
end
|
||||
[version, builds.first]
|
||||
}.sort_by { |version, entry|
|
||||
version
|
||||
Gem::Version.new(version)
|
||||
}.select { |version, entry|
|
||||
Gem::Version.new(version) >= Gem::Version.new(min_version)
|
||||
}.map { |version, entry|
|
||||
|
||||
@@ -100,7 +100,7 @@ function setupPath(ruby, newPathEntries) {
|
||||
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||
|
||||
if (cleanPath.length !== originalPath.length) {
|
||||
console.log("Entries removed from PATH to avoid conflicts with Ruby:")
|
||||
console.log('Entries removed from PATH to avoid conflicts with Ruby:')
|
||||
for (const entry of originalPath) {
|
||||
if (!cleanPath.includes(entry)) {
|
||||
console.log(` ${entry}`)
|
||||
@@ -142,27 +142,35 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
let versionArray
|
||||
if (bundlerVersion === 'latest') {
|
||||
bundlerVersion = '2'
|
||||
}
|
||||
|
||||
if (rubyVersion.startsWith('2.2')) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 2.2')
|
||||
versionArray = ['-v', '~> 1']
|
||||
bundlerVersion = '1'
|
||||
} else if (/^\d+/.test(bundlerVersion)) {
|
||||
versionArray = ['-v', `~> ${bundlerVersion}`]
|
||||
} else if (bundlerVersion === 'latest') {
|
||||
versionArray = []
|
||||
// OK
|
||||
} else {
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'rubinius') {
|
||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
||||
} else if (bundlerVersion === '1' && engine === 'truffleruby') {
|
||||
if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') {
|
||||
console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`)
|
||||
} else if (engine === 'truffleruby' && bundlerVersion === '1') {
|
||||
console.log(`Using the Bundler version shipped with ${engine}`)
|
||||
} else if (engine === 'rubinius') {
|
||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
||||
} else {
|
||||
await exec.exec(path.join(rubyPrefix, 'bin', 'gem'), ['install', 'bundler', ...versionArray, '--no-document'])
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
await exec.exec(gem, ['install', 'bundler', '-v', `~> ${bundlerVersion}`, '--no-document'])
|
||||
}
|
||||
}
|
||||
|
||||
function isHeadVersion(rubyVersion) {
|
||||
return rubyVersion === 'head' || rubyVersion === 'mingw' || rubyVersion === 'mswin'
|
||||
}
|
||||
|
||||
function getVirtualEnvironmentName() {
|
||||
const platform = os.platform()
|
||||
if (platform === 'linux') {
|
||||
|
||||
@@ -11,19 +11,23 @@ export const versions = {
|
||||
"2.4.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.6-1/rubyinstaller-2.4.6-1-x64.7z",
|
||||
"2.4.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.7-1/rubyinstaller-2.4.7-1-x64.7z",
|
||||
"2.4.9": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.9-1/rubyinstaller-2.4.9-1-x64.7z",
|
||||
"2.4.10": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.4.10-1/rubyinstaller-2.4.10-1-x64.7z",
|
||||
"2.5.0": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.0-2/rubyinstaller-2.5.0-2-x64.7z",
|
||||
"2.5.1": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.1-2/rubyinstaller-2.5.1-2-x64.7z",
|
||||
"2.5.3": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-2.5.3-1/rubyinstaller-2.5.3-1-x64.7z",
|
||||
"2.5.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.5-1/rubyinstaller-2.5.5-1-x64.7z",
|
||||
"2.5.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.6-1/rubyinstaller-2.5.6-1-x64.7z",
|
||||
"2.5.7": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.7-1/rubyinstaller-2.5.7-1-x64.7z",
|
||||
"2.5.8": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.5.8-1/rubyinstaller-2.5.8-1-x64.7z",
|
||||
"2.6.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.0-1/rubyinstaller-2.6.0-1-x64.7z",
|
||||
"2.6.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.1-1/rubyinstaller-2.6.1-1-x64.7z",
|
||||
"2.6.2": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.2-1/rubyinstaller-2.6.2-1-x64.7z",
|
||||
"2.6.3": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.3-1/rubyinstaller-2.6.3-1-x64.7z",
|
||||
"2.6.4": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.4-1/rubyinstaller-2.6.4-1-x64.7z",
|
||||
"2.6.5": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.5-1/rubyinstaller-2.6.5-1-x64.7z",
|
||||
"2.6.6": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.6.6-1/rubyinstaller-2.6.6-1-x64.7z",
|
||||
"2.7.0": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.0-1/rubyinstaller-2.7.0-1-x64.7z",
|
||||
"2.7.1": "https://github.com/oneclick/rubyinstaller2/releases/download/RubyInstaller-2.7.1-1/rubyinstaller-2.7.1-1-x64.7z",
|
||||
"head": "https://github.com/oneclick/rubyinstaller2/releases/download/rubyinstaller-head/rubyinstaller-head-x64.7z",
|
||||
"mingw": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mingw.7z",
|
||||
"mswin": "https://github.com/MSP-Greg/ruby-loco/releases/download/ruby-master/ruby-mswin.7z"
|
||||
|
||||
Reference in New Issue
Block a user