Skip to content

Commit 5fe1a66

Browse files
deivid-rodriguezeregon
authored andcommitted
Respect explicit user's choice
1 parent bb3a055 commit 5fe1a66

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

bundler.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -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\.[01]/.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

dist/index.js

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

0 commit comments

Comments
 (0)