mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
359bebbc29 | ||
|
|
fabf2515e6 |
+8
-3
@@ -71,7 +71,9 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||
@@ -82,7 +84,10 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
||||
bundlerVersion = '1'
|
||||
}
|
||||
|
||||
if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
|
||||
// Workaround for truffleruby 22.0 + latest Bundler, use shipped Bundler instead: https://github.com/oracle/truffleruby/issues/2586
|
||||
const useShippedBundler2 = common.isHeadVersion(rubyVersion) || (engine.startsWith('truffleruby') && rubyVersion.startsWith('22.0'))
|
||||
|
||||
if (useShippedBundler2 && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
|
||||
// Avoid installing a newer Bundler version for head versions as it might not work.
|
||||
// For releases, even if they ship with Bundler 2 we install the latest Bundler.
|
||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||
@@ -92,7 +97,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||
const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : []
|
||||
const force = (platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) ? ['--force'] : []
|
||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||
}
|
||||
|
||||
|
||||
+16
-10
@@ -85,7 +85,9 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||
@@ -96,7 +98,10 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
||||
bundlerVersion = '1'
|
||||
}
|
||||
|
||||
if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
|
||||
// Workaround for truffleruby 22.0 + latest Bundler, use shipped Bundler instead: https://github.com/oracle/truffleruby/issues/2586
|
||||
const useShippedBundler2 = common.isHeadVersion(rubyVersion) || (engine.startsWith('truffleruby') && rubyVersion.startsWith('22.0'))
|
||||
|
||||
if (useShippedBundler2 && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
|
||||
// Avoid installing a newer Bundler version for head versions as it might not work.
|
||||
// For releases, even if they ship with Bundler 2 we install the latest Bundler.
|
||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||
@@ -106,7 +111,7 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
|
||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||
const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : []
|
||||
const force = (platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) ? ['--force'] : []
|
||||
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
|
||||
}
|
||||
|
||||
@@ -59590,16 +59595,17 @@ async function setupRuby(options = {}) {
|
||||
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
|
||||
}
|
||||
|
||||
const [gemfile, lockFile] = bundler.detectGemfiles()
|
||||
let bundlerVersion = "unknown"
|
||||
|
||||
if (inputs['bundler'] !== 'none') {
|
||||
const [gemfile, lockFile] = bundler.detectGemfiles()
|
||||
|
||||
const bundlerVersion = await common.measure('Installing Bundler', async () =>
|
||||
bundlerVersion = await common.measure('Installing Bundler', async () =>
|
||||
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
|
||||
}
|
||||
|
||||
if (inputs['bundler-cache'] === 'true') {
|
||||
await common.measure('bundle install', async () =>
|
||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||
}
|
||||
if (inputs['bundler-cache'] === 'true') {
|
||||
await common.measure('bundle install', async () =>
|
||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||
}
|
||||
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
|
||||
@@ -78,16 +78,17 @@ export async function setupRuby(options = {}) {
|
||||
await inputs['afterSetupPathHook']({ platform, rubyPrefix, engine, version })
|
||||
}
|
||||
|
||||
const [gemfile, lockFile] = bundler.detectGemfiles()
|
||||
let bundlerVersion = "unknown"
|
||||
|
||||
if (inputs['bundler'] !== 'none') {
|
||||
const [gemfile, lockFile] = bundler.detectGemfiles()
|
||||
|
||||
const bundlerVersion = await common.measure('Installing Bundler', async () =>
|
||||
bundlerVersion = await common.measure('Installing Bundler', async () =>
|
||||
bundler.installBundler(inputs['bundler'], lockFile, platform, rubyPrefix, engine, version))
|
||||
}
|
||||
|
||||
if (inputs['bundler-cache'] === 'true') {
|
||||
await common.measure('bundle install', async () =>
|
||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||
}
|
||||
if (inputs['bundler-cache'] === 'true') {
|
||||
await common.measure('bundle install', async () =>
|
||||
bundler.bundleInstall(gemfile, lockFile, platform, engine, version, bundlerVersion, inputs['cache-version']))
|
||||
}
|
||||
|
||||
core.setOutput('ruby-prefix', rubyPrefix)
|
||||
|
||||
Reference in New Issue
Block a user