Set BUNDLER_VERSION whenever we know which version to use

* Fixes https://github.com/ruby/setup-ruby/issues/845
This commit is contained in:
Benoit Daloze
2025-12-31 23:13:45 +01:00
parent 8a836efbce
commit 4c24fa5ec0
3 changed files with 21 additions and 8 deletions
Generated Vendored
+4 -4
View File
@@ -176,10 +176,10 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
}
let envOptions = {}
if (bundlerVersion.startsWith('1') && common.isBundler2PlusDefault(engine, rubyVersion)) {
// If Bundler 1 is specified on Rubies which ship with Bundler 2+,
// we need to specify which Bundler version to use explicitly until the lockfile exists.
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler 1 is used`)
if (bundlerVersion.match(/^\d+/)) {
// If a specific Bundler version is given or determined, we need to specify the version to use explicitly until the lockfile exists.
// Otherwise, a newer version of Bundler might be used.
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler ${bundlerVersion} is used`)
envOptions = { env: { ...process.env, BUNDLER_VERSION: bundlerVersion } }
}