Skip to content

Commit 359bebb

Browse files
committed
Use the shipped Bundler on TruffleRuby 22.0
* To workaround truffleruby/truffleruby#2586
1 parent fabf251 commit 359bebb

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

bundler.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
7171
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
7272
}
7373

74-
if (engine === 'ruby' && common.floatVersion(rubyVersion) <= 2.2) {
74+
const floatVersion = common.floatVersion(rubyVersion)
75+
76+
if (engine === 'ruby' && floatVersion <= 2.2) {
7577
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
7678
bundlerVersion = '1'
7779
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
@@ -82,7 +84,10 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
8284
bundlerVersion = '1'
8385
}
8486

85-
if (common.isHeadVersion(rubyVersion) && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
87+
// Workaround for truffleruby 22.0 + latest Bundler, use shipped Bundler instead: https://github.com/oracle/truffleruby/issues/2586
88+
const useShippedBundler2 = common.isHeadVersion(rubyVersion) || (engine.startsWith('truffleruby') && rubyVersion.startsWith('22.0'))
89+
90+
if (useShippedBundler2 && common.isBundler2Default(engine, rubyVersion) && bundlerVersion.startsWith('2')) {
8691
// Avoid installing a newer Bundler version for head versions as it might not work.
8792
// For releases, even if they ship with Bundler 2 we install the latest Bundler.
8893
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
@@ -92,7 +97,7 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
9297
const gem = path.join(rubyPrefix, 'bin', 'gem')
9398
const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}`
9499
// Workaround for https://github.com/rubygems/rubygems/issues/5245
95-
const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : []
100+
const force = (platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) ? ['--force'] : []
96101
await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint])
97102
}
98103

dist/index.js

Lines changed: 8 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)