Skip to content

Commit 4c24fa5

Browse files
committed
Set BUNDLER_VERSION whenever we know which version to use
* Fixes #845
1 parent 8a836ef commit 4c24fa5

File tree

3 files changed

+21
-8
lines changed

3 files changed

+21
-8
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,19 @@ jobs:
352352
bundler: 2.2.3
353353
- run: bundle --version | grep -F "Bundler version 2.2.3"
354354

355+
# https://github.com/ruby/setup-ruby/issues/845
356+
testOlderBundlerVersion:
357+
name: "Test with an older Bundler version than the one of the default gem"
358+
runs-on: ubuntu-latest
359+
steps:
360+
- uses: actions/checkout@v6
361+
- uses: ./
362+
with:
363+
ruby-version: '4.0'
364+
bundler: 2.7.2
365+
bundler-cache: true
366+
- run: bundle --version | grep -F "Bundler version 2.7.2"
367+
355368
testBundlerPre:
356369
name: "Test with a Bundler pre/rc version"
357370
runs-on: ubuntu-latest

bundler.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,10 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
162162
}
163163

164164
let envOptions = {}
165-
if (bundlerVersion.startsWith('1') && common.isBundler2PlusDefault(engine, rubyVersion)) {
166-
// If Bundler 1 is specified on Rubies which ship with Bundler 2+,
167-
// we need to specify which Bundler version to use explicitly until the lockfile exists.
168-
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler 1 is used`)
165+
if (bundlerVersion.match(/^\d+/)) {
166+
// If a specific Bundler version is given or determined, we need to specify the version to use explicitly until the lockfile exists.
167+
// Otherwise, a newer version of Bundler might be used.
168+
console.log(`Setting BUNDLER_VERSION=${bundlerVersion} for "bundle config|lock" commands below to ensure Bundler ${bundlerVersion} is used`)
169169
envOptions = { env: { ...process.env, BUNDLER_VERSION: bundlerVersion } }
170170
}
171171

dist/index.js

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)