mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-14 15:04: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
|
## Credits
|
||||||
|
|
||||||
The current maintainer of this action is @eregon.
|
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.
|
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))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
|
|
||||||
if (cleanPath.length !== originalPath.length) {
|
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) {
|
for (const entry of originalPath) {
|
||||||
if (!cleanPath.includes(entry)) {
|
if (!cleanPath.includes(entry)) {
|
||||||
console.log(` ${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')) {
|
if (rubyVersion.startsWith('2.2')) {
|
||||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 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)) {
|
} else if (/^\d+/.test(bundlerVersion)) {
|
||||||
versionArray = ['-v', `~> ${bundlerVersion}`]
|
// OK
|
||||||
} else if (bundlerVersion === 'latest') {
|
|
||||||
versionArray = []
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine === 'rubinius') {
|
if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') {
|
||||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`)
|
||||||
} else if (bundlerVersion === '1' && engine === 'truffleruby') {
|
} else if (engine === 'truffleruby' && bundlerVersion === '1') {
|
||||||
console.log(`Using the Bundler version shipped with ${engine}`)
|
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 {
|
} 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() {
|
function getVirtualEnvironmentName() {
|
||||||
const platform = os.platform()
|
const platform = os.platform()
|
||||||
if (platform === 'linux') {
|
if (platform === 'linux') {
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ function setupPath(ruby, newPathEntries) {
|
|||||||
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
let cleanPath = originalPath.filter(entry => !/\bruby\b/i.test(entry))
|
||||||
|
|
||||||
if (cleanPath.length !== originalPath.length) {
|
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) {
|
for (const entry of originalPath) {
|
||||||
if (!cleanPath.includes(entry)) {
|
if (!cleanPath.includes(entry)) {
|
||||||
console.log(` ${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')) {
|
if (rubyVersion.startsWith('2.2')) {
|
||||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby 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)) {
|
} else if (/^\d+/.test(bundlerVersion)) {
|
||||||
versionArray = ['-v', `~> ${bundlerVersion}`]
|
// OK
|
||||||
} else if (bundlerVersion === 'latest') {
|
|
||||||
versionArray = []
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (engine === 'rubinius') {
|
if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') {
|
||||||
console.log(`Rubinius only supports the version of Bundler shipped with it`)
|
console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`)
|
||||||
} else if (bundlerVersion === '1' && engine === 'truffleruby') {
|
} else if (engine === 'truffleruby' && bundlerVersion === '1') {
|
||||||
console.log(`Using the Bundler version shipped with ${engine}`)
|
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 {
|
} 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() {
|
function getVirtualEnvironmentName() {
|
||||||
const platform = os.platform()
|
const platform = os.platform()
|
||||||
if (platform === 'linux') {
|
if (platform === 'linux') {
|
||||||
|
|||||||
Reference in New Issue
Block a user