@@ -107,24 +107,28 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
107107 }
108108
109109 // Use Bundler 1 when we know Bundler 2 does not work
110- // Use Bundler 2.3 when we use Ruby 2.3.2-2.5
111- // Use Bundler 2.4 when we use Ruby 2.6-2.7
112110 if ( bundlerVersion . startsWith ( '2' ) ) {
113111 if ( engine === 'ruby' && floatVersion <= 2.2 ) {
114112 console . log ( 'Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2' )
115113 bundlerVersion = '1'
116114 } else if ( engine === 'ruby' && / ^ 2 \. 3 \. [ 0 1 ] / . test ( rubyVersion ) ) {
117115 console . log ( 'Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1' )
118116 bundlerVersion = '1'
119- } else if ( engine === 'ruby' && floatVersion <= 2.5 ) {
117+ } else if ( engine === 'jruby' && rubyVersion . startsWith ( '9.1' ) ) { // JRuby 9.1 targets Ruby 2.3, treat it the same
118+ console . log ( 'JRuby 9.1 has a bug with Bundler 2 (https://github.com/ruby/setup-ruby/issues/108), using Bundler 1 instead on JRuby 9.1' )
119+ bundlerVersion = '1'
120+ }
121+ }
122+
123+ // Use Bundler 2.3 when we use Ruby 2.3.2-2.5
124+ // Use Bundler 2.4 when we use Ruby 2.6-2.7
125+ if ( bundlerVersion == '2' ) {
126+ if ( engine === 'ruby' && floatVersion <= 2.5 ) {
120127 console . log ( 'Ruby 2.3.2-2.5 only works with Bundler 2.3' )
121128 bundlerVersion = '2.3'
122129 } else if ( engine === 'ruby' && floatVersion <= 2.7 ) {
123130 console . log ( 'Ruby 2.6-2.7 only works with Bundler 2.4' )
124131 bundlerVersion = '2.4'
125- } else if ( engine === 'jruby' && rubyVersion . startsWith ( '9.1' ) ) { // JRuby 9.1 targets Ruby 2.3, treat it the same
126- console . log ( 'JRuby 9.1 has a bug with Bundler 2 (https://github.com/ruby/setup-ruby/issues/108), using Bundler 1 instead on JRuby 9.1' )
127- bundlerVersion = '1'
128132 }
129133 }
130134
0 commit comments