@@ -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 \. [ 0 1 ] / . 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
0 commit comments