mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03b78bdda2 | ||
|
|
5fe1a6694c | ||
|
|
bb3a0553d5 |
+13
-4
@@ -107,7 +107,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
}
|
||||
|
||||
// Use Bundler 1 when we know Bundler 2 does not work
|
||||
// Use Bundler 2.3 when we use Ruby 2.3.2-2.5
|
||||
if (bundlerVersion.startsWith('2')) {
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
@@ -115,15 +114,25 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && floatVersion <= 2.5) {
|
||||
console.log('Ruby 2.3.2-2.5 only works with Bundler 2.3')
|
||||
bundlerVersion = '2.3'
|
||||
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
||||
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')
|
||||
bundlerVersion = '1'
|
||||
}
|
||||
}
|
||||
|
||||
const targetRubyVersion = common.targetRubyVersion(engine, rubyVersion)
|
||||
// Use Bundler 2.3 when we use Ruby 2.3.2 - 2.5
|
||||
// Use Bundler 2.4 when we use Ruby 2.6-2.7
|
||||
if (bundlerVersion == '2') {
|
||||
if (targetRubyVersion <= 2.5) { // < 2.3.2 already handled above
|
||||
console.log('Ruby 2.3.2 - 2.5 only works with Bundler 2.3')
|
||||
bundlerVersion = '2.3'
|
||||
} else if (targetRubyVersion <= 2.7) {
|
||||
console.log('Ruby 2.6-2.7 only works with Bundler 2.4')
|
||||
bundlerVersion = '2.4'
|
||||
}
|
||||
}
|
||||
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||
// and for https://github.com/oracle/truffleruby/issues/2780
|
||||
|
||||
@@ -95,6 +95,23 @@ export function isBundler2dot2Default(engine, rubyVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
export function targetRubyVersion(engine, rubyVersion) {
|
||||
const version = floatVersion(rubyVersion)
|
||||
if (engine === 'ruby') {
|
||||
return version
|
||||
} else if (engine === 'jruby') {
|
||||
if (version === 9.1) {
|
||||
return 2.3
|
||||
} else if (version === 9.2) {
|
||||
return 2.5
|
||||
} else if (version === 9.3) {
|
||||
return 2.6
|
||||
}
|
||||
}
|
||||
|
||||
return 9.9 // unknown, assume recent
|
||||
}
|
||||
|
||||
export function floatVersion(rubyVersion) {
|
||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||
if (match) {
|
||||
|
||||
+31
-4
@@ -122,7 +122,6 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
||||
}
|
||||
|
||||
// Use Bundler 1 when we know Bundler 2 does not work
|
||||
// Use Bundler 2.3 when we use Ruby 2.3.2-2.5
|
||||
if (bundlerVersion.startsWith('2')) {
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
console.log('Bundler 2 requires Ruby 2.3+, using Bundler 1 on Ruby <= 2.2')
|
||||
@@ -130,15 +129,25 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
||||
} else if (engine === 'ruby' && /^2\.3\.[01]/.test(rubyVersion)) {
|
||||
console.log('Ruby 2.3.0 and 2.3.1 have shipped with an old rubygems that only works with Bundler 1')
|
||||
bundlerVersion = '1'
|
||||
} else if (engine === 'ruby' && floatVersion <= 2.5) {
|
||||
console.log('Ruby 2.3.2-2.5 only works with Bundler 2.3')
|
||||
bundlerVersion = '2.3'
|
||||
} else if (engine === 'jruby' && rubyVersion.startsWith('9.1')) { // JRuby 9.1 targets Ruby 2.3, treat it the same
|
||||
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')
|
||||
bundlerVersion = '1'
|
||||
}
|
||||
}
|
||||
|
||||
const targetRubyVersion = common.targetRubyVersion(engine, rubyVersion)
|
||||
// Use Bundler 2.3 when we use Ruby 2.3.2 - 2.5
|
||||
// Use Bundler 2.4 when we use Ruby 2.6-2.7
|
||||
if (bundlerVersion == '2') {
|
||||
if (targetRubyVersion <= 2.5) { // < 2.3.2 already handled above
|
||||
console.log('Ruby 2.3.2 - 2.5 only works with Bundler 2.3')
|
||||
bundlerVersion = '2.3'
|
||||
} else if (targetRubyVersion <= 2.7) {
|
||||
console.log('Ruby 2.6-2.7 only works with Bundler 2.4')
|
||||
bundlerVersion = '2.4'
|
||||
}
|
||||
}
|
||||
|
||||
const gem = path.join(rubyPrefix, 'bin', 'gem')
|
||||
// Workaround for https://github.com/rubygems/rubygems/issues/5245
|
||||
// and for https://github.com/oracle/truffleruby/issues/2780
|
||||
@@ -277,6 +286,7 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
/* harmony export */ "isBundler2dot2Default": () => (/* binding */ isBundler2dot2Default),
|
||||
/* harmony export */ "targetRubyVersion": () => (/* binding */ targetRubyVersion),
|
||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
||||
/* harmony export */ "hashFile": () => (/* binding */ hashFile),
|
||||
/* harmony export */ "supportedPlatforms": () => (/* binding */ supportedPlatforms),
|
||||
@@ -384,6 +394,23 @@ function isBundler2dot2Default(engine, rubyVersion) {
|
||||
}
|
||||
}
|
||||
|
||||
function targetRubyVersion(engine, rubyVersion) {
|
||||
const version = floatVersion(rubyVersion)
|
||||
if (engine === 'ruby') {
|
||||
return version
|
||||
} else if (engine === 'jruby') {
|
||||
if (version === 9.1) {
|
||||
return 2.3
|
||||
} else if (version === 9.2) {
|
||||
return 2.5
|
||||
} else if (version === 9.3) {
|
||||
return 2.6
|
||||
}
|
||||
}
|
||||
|
||||
return 9.9 // unknown, assume recent
|
||||
}
|
||||
|
||||
function floatVersion(rubyVersion) {
|
||||
const match = rubyVersion.match(/^\d+\.\d+/)
|
||||
if (match) {
|
||||
|
||||
Reference in New Issue
Block a user