Skip to content

Commit 9b993bc

Browse files
committed
Use the given Bundler 1.x version if supplied on old Rubies
* Fixes #327
1 parent d6a695a commit 9b993bc

File tree

2 files changed

+24
-18
lines changed

2 files changed

+24
-18
lines changed

bundler.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,15 +78,18 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
7878

7979
const floatVersion = common.floatVersion(rubyVersion)
8080

81-
if (engine === 'ruby' && floatVersion <= 2.2) {
82-
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
83-
bundlerVersion = '1'
84-
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
85-
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
86-
bundlerVersion = '1'
87-
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
88-
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')
89-
bundlerVersion = '1'
81+
// Use Bundler 1 when we know Bundler 2 does not work
82+
if (bundlerVersion.startsWith('2')) {
83+
if (engine === 'ruby' && floatVersion <= 2.2) {
84+
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
85+
bundlerVersion = '1'
86+
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
87+
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
88+
bundlerVersion = '1'
89+
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
90+
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')
91+
bundlerVersion = '1'
92+
}
9093
}
9194

9295
// Workaround for truffleruby 22.0 + latest Bundler, use shipped Bundler instead: https://github.com/oracle/truffleruby/issues/2586

dist/index.js

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

0 commit comments

Comments
 (0)