Skip to content

Commit e8f04a3

Browse files
committed
Use latest Bundler on CRuby 2.6 and 2.7 as their default Bundler is too old
1 parent bb1d54f commit e8f04a3

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

bundler.js

+10-4
Original file line numberDiff line numberDiff line change
@@ -68,11 +68,19 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
6868
}
6969
}
7070

71+
const floatVersion = common.floatVersion(rubyVersion)
72+
7173
if (bundlerVersion === 'default') {
72-
if (common.isBundler2Default(engine, rubyVersion)) {
74+
if (engine === 'ruby' && floatVersion < 3.0 && common.hasBundlerDefaultGem(engine, rubyVersion)) {
75+
// Ruby 2.6 and 2.7 have a old Bundler default gem which does not work well for `gem 'foo', github: 'foo/foo'`:
76+
// https://github.com/ruby/setup-ruby/issues/358#issuecomment-1195899304
77+
// Also, Ruby 2.6 would get Bundler 1 yet Ruby 2.3 - 2.5 get latest Bundler 2 which might be unexpected.
78+
console.log(`Using latest Bundler for ${engine}-${rubyVersion} because the default Bundler gem is too old for that Ruby version`)
79+
bundlerVersion = 'latest'
80+
} else if (common.isBundler2Default(engine, rubyVersion)) {
7381
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
7482
return '2'
75-
} else if (common.isBundler1Default(engine, rubyVersion)) {
83+
} else if (common.isBundler1Default(engine, rubyVersion) && engine !== 'ruby') {
7684
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
7785
return '1'
7886
} else {
@@ -90,8 +98,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
9098
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
9199
}
92100

93-
const floatVersion = common.floatVersion(rubyVersion)
94-
95101
// Use Bundler 1 when we know Bundler 2 does not work
96102
if (bundlerVersion.startsWith('2')) {
97103
if (engine === 'ruby' && floatVersion <= 2.2) {

common.js

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ export function isStableVersion(rubyVersion) {
5555
return /^\d+(\.\d+)*$/.test(rubyVersion)
5656
}
5757

58+
export function hasBundlerDefaultGem(engine, rubyVersion) {
59+
return isBundler1Default(engine, rubyVersion) || isBundler2Default(engine, rubyVersion)
60+
}
61+
5862
export function isBundler1Default(engine, rubyVersion) {
5963
if (engine === 'ruby') {
6064
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7

dist/index.js

+15-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)