mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
d4f9058279 | ||
|
|
c40ce85201 | ||
|
|
c68e25cb8c | ||
|
|
95135e9903 |
@@ -163,5 +163,5 @@ Please [update](https://github.com/ruby/setup-ruby/releases/tag/v1.13.0) if you
|
||||
## 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.
|
||||
|
||||
+18
-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') {
|
||||
|
||||
@@ -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') {
|
||||
|
||||
Reference in New Issue
Block a user