mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 22:44:20 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8f04a3cee |
+10
-4
@@ -68,11 +68,19 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const floatVersion = common.floatVersion(rubyVersion)
|
||||||
|
|
||||||
if (bundlerVersion === 'default') {
|
if (bundlerVersion === 'default') {
|
||||||
if (common.isBundler2Default(engine, rubyVersion)) {
|
if (engine === 'ruby' && floatVersion < 3.0 && common.hasBundlerDefaultGem(engine, rubyVersion)) {
|
||||||
|
// Ruby 2.6 and 2.7 have a old Bundler default gem which does not work well for `gem 'foo', github: 'foo/foo'`:
|
||||||
|
// https://github.com/ruby/setup-ruby/issues/358#issuecomment-1195899304
|
||||||
|
// Also, Ruby 2.6 would get Bundler 1 yet Ruby 2.3 - 2.5 get latest Bundler 2 which might be unexpected.
|
||||||
|
console.log(`Using latest Bundler for ${engine}-${rubyVersion} because the default Bundler gem is too old for that Ruby version`)
|
||||||
|
bundlerVersion = 'latest'
|
||||||
|
} else if (common.isBundler2Default(engine, rubyVersion)) {
|
||||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||||
return '2'
|
return '2'
|
||||||
} else if (common.isBundler1Default(engine, rubyVersion)) {
|
} else if (common.isBundler1Default(engine, rubyVersion) && engine !== 'ruby') {
|
||||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||||
return '1'
|
return '1'
|
||||||
} else {
|
} else {
|
||||||
@@ -90,8 +98,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
|||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const floatVersion = common.floatVersion(rubyVersion)
|
|
||||||
|
|
||||||
// Use Bundler 1 when we know Bundler 2 does not work
|
// Use Bundler 1 when we know Bundler 2 does not work
|
||||||
if (bundlerVersion.startsWith('2')) {
|
if (bundlerVersion.startsWith('2')) {
|
||||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||||
|
|||||||
@@ -55,6 +55,10 @@ export function isStableVersion(rubyVersion) {
|
|||||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function hasBundlerDefaultGem(engine, rubyVersion) {
|
||||||
|
return isBundler1Default(engine, rubyVersion) || isBundler2Default(engine, rubyVersion)
|
||||||
|
}
|
||||||
|
|
||||||
export function isBundler1Default(engine, rubyVersion) {
|
export function isBundler1Default(engine, rubyVersion) {
|
||||||
if (engine === 'ruby') {
|
if (engine === 'ruby') {
|
||||||
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
||||||
|
|||||||
+15
-4
@@ -82,11 +82,19 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const floatVersion = common.floatVersion(rubyVersion)
|
||||||
|
|
||||||
if (bundlerVersion === 'default') {
|
if (bundlerVersion === 'default') {
|
||||||
if (common.isBundler2Default(engine, rubyVersion)) {
|
if (engine === 'ruby' && floatVersion < 3.0 && common.hasBundlerDefaultGem(engine, rubyVersion)) {
|
||||||
|
// Ruby 2.6 and 2.7 have a old Bundler default gem which does not work well for `gem 'foo', github: 'foo/foo'`:
|
||||||
|
// https://github.com/ruby/setup-ruby/issues/358#issuecomment-1195899304
|
||||||
|
// Also, Ruby 2.6 would get Bundler 1 yet Ruby 2.3 - 2.5 get latest Bundler 2 which might be unexpected.
|
||||||
|
console.log(`Using latest Bundler for ${engine}-${rubyVersion} because the default Bundler gem is too old for that Ruby version`)
|
||||||
|
bundlerVersion = 'latest'
|
||||||
|
} else if (common.isBundler2Default(engine, rubyVersion)) {
|
||||||
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
|
||||||
return '2'
|
return '2'
|
||||||
} else if (common.isBundler1Default(engine, rubyVersion)) {
|
} else if (common.isBundler1Default(engine, rubyVersion) && engine !== 'ruby') {
|
||||||
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
|
||||||
return '1'
|
return '1'
|
||||||
} else {
|
} else {
|
||||||
@@ -104,8 +112,6 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
|||||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||||
}
|
}
|
||||||
|
|
||||||
const floatVersion = common.floatVersion(rubyVersion)
|
|
||||||
|
|
||||||
// Use Bundler 1 when we know Bundler 2 does not work
|
// Use Bundler 1 when we know Bundler 2 does not work
|
||||||
if (bundlerVersion.startsWith('2')) {
|
if (bundlerVersion.startsWith('2')) {
|
||||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||||
@@ -253,6 +259,7 @@ __nccwpck_require__.r(__webpack_exports__);
|
|||||||
/* harmony export */ "measure": () => (/* binding */ measure),
|
/* harmony export */ "measure": () => (/* binding */ measure),
|
||||||
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||||
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
||||||
|
/* harmony export */ "hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
||||||
@@ -322,6 +329,10 @@ function isStableVersion(rubyVersion) {
|
|||||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function hasBundlerDefaultGem(engine, rubyVersion) {
|
||||||
|
return isBundler1Default(engine, rubyVersion) || isBundler2Default(engine, rubyVersion)
|
||||||
|
}
|
||||||
|
|
||||||
function isBundler1Default(engine, rubyVersion) {
|
function isBundler1Default(engine, rubyVersion) {
|
||||||
if (engine === 'ruby') {
|
if (engine === 'ruby') {
|
||||||
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
||||||
|
|||||||
Reference in New Issue
Block a user