@@ -68,11 +68,19 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
68
68
}
69
69
}
70
70
71
+ const floatVersion = common . floatVersion ( rubyVersion )
72
+
71
73
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 ) ) {
73
81
console . log ( `Using Bundler 2 shipped with ${ engine } -${ rubyVersion } ` )
74
82
return '2'
75
- } else if ( common . isBundler1Default ( engine , rubyVersion ) ) {
83
+ } else if ( common . isBundler1Default ( engine , rubyVersion ) && engine !== 'ruby' ) {
76
84
console . log ( `Using Bundler 1 shipped with ${ engine } -${ rubyVersion } ` )
77
85
return '1'
78
86
} else {
@@ -90,8 +98,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
90
98
throw new Error ( `Cannot parse bundler input: ${ bundlerVersion } ` )
91
99
}
92
100
93
- const floatVersion = common . floatVersion ( rubyVersion )
94
-
95
101
// Use Bundler 1 when we know Bundler 2 does not work
96
102
if ( bundlerVersion . startsWith ( '2' ) ) {
97
103
if ( engine === 'ruby' && floatVersion <= 2.2 ) {
0 commit comments