mirror of
https://github.com/ruby/setup-ruby.git
synced 2026-09-13 14:34:21 +02:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8f04a3cee | ||
|
|
bb1d54ff77 |
+11
-5
@@ -68,11 +68,19 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
}
|
||||
}
|
||||
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
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}`)
|
||||
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}`)
|
||||
return '1'
|
||||
} else {
|
||||
@@ -90,8 +98,6 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
// Use Bundler 1 when we know Bundler 2 does not work
|
||||
if (bundlerVersion.startsWith('2')) {
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
@@ -202,7 +208,7 @@ export async function bundleInstall(gemfile, lockFile, platform, engine, rubyVer
|
||||
|
||||
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
|
||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
||||
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||
let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||
|
||||
if (common.isHeadVersion(version)) {
|
||||
if (engine !== 'jruby') {
|
||||
|
||||
@@ -55,6 +55,10 @@ export function isStableVersion(rubyVersion) {
|
||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||
}
|
||||
|
||||
export function hasBundlerDefaultGem(engine, rubyVersion) {
|
||||
return isBundler1Default(engine, rubyVersion) || isBundler2Default(engine, rubyVersion)
|
||||
}
|
||||
|
||||
export function isBundler1Default(engine, rubyVersion) {
|
||||
if (engine === 'ruby') {
|
||||
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
||||
|
||||
+16
-5
@@ -82,11 +82,19 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
||||
}
|
||||
}
|
||||
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
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}`)
|
||||
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}`)
|
||||
return '1'
|
||||
} else {
|
||||
@@ -104,8 +112,6 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p
|
||||
throw new Error(`Cannot parse bundler input: ${bundlerVersion}`)
|
||||
}
|
||||
|
||||
const floatVersion = common.floatVersion(rubyVersion)
|
||||
|
||||
// Use Bundler 1 when we know Bundler 2 does not work
|
||||
if (bundlerVersion.startsWith('2')) {
|
||||
if (engine === 'ruby' && floatVersion <= 2.2) {
|
||||
@@ -216,7 +222,7 @@ async function bundleInstall(gemfile, lockFile, platform, engine, rubyVersion, b
|
||||
|
||||
async function computeBaseKey(platform, engine, version, lockFile, cacheVersion) {
|
||||
const cacheVersionSuffix = DEFAULT_CACHE_VERSION === cacheVersion ? '' : `-cachever:${cacheVersion}`
|
||||
let key = `setup-ruby-bundler-cache-v3-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||
let key = `setup-ruby-bundler-cache-v4-${platform}-${engine}-${version}${cacheVersionSuffix}`
|
||||
|
||||
if (common.isHeadVersion(version)) {
|
||||
if (engine !== 'jruby') {
|
||||
@@ -253,6 +259,7 @@ __nccwpck_require__.r(__webpack_exports__);
|
||||
/* harmony export */ "measure": () => (/* binding */ measure),
|
||||
/* harmony export */ "isHeadVersion": () => (/* binding */ isHeadVersion),
|
||||
/* harmony export */ "isStableVersion": () => (/* binding */ isStableVersion),
|
||||
/* harmony export */ "hasBundlerDefaultGem": () => (/* binding */ hasBundlerDefaultGem),
|
||||
/* harmony export */ "isBundler1Default": () => (/* binding */ isBundler1Default),
|
||||
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
|
||||
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
|
||||
@@ -322,6 +329,10 @@ function isStableVersion(rubyVersion) {
|
||||
return /^\d+(\.\d+)*$/.test(rubyVersion)
|
||||
}
|
||||
|
||||
function hasBundlerDefaultGem(engine, rubyVersion) {
|
||||
return isBundler1Default(engine, rubyVersion) || isBundler2Default(engine, rubyVersion)
|
||||
}
|
||||
|
||||
function isBundler1Default(engine, rubyVersion) {
|
||||
if (engine === 'ruby') {
|
||||
return floatVersion(rubyVersion) >= 2.6 && floatVersion(rubyVersion) < 2.7
|
||||
|
||||
Reference in New Issue
Block a user