Fix check for TruffleRuby < 21.0 and Bundler 1

This commit is contained in:
Benoit Daloze
2021-07-27 13:35:24 +02:00
parent 0c7e9c4d53
commit 0997e21bf3
3 changed files with 13 additions and 4 deletions
+2 -2
View File
@@ -86,8 +86,8 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru
// Avoid installing a newer Bundler version for head versions as it might not work. // Avoid installing a newer Bundler version for head versions as it might not work.
// For releases, even if they ship with Bundler 2 we install the latest Bundler. // For releases, even if they ship with Bundler 2 we install the latest Bundler.
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) { } else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}`) console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}` const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
+4
View File
@@ -55,6 +55,10 @@ export function isStableVersion(rubyVersion) {
return /^\d+(\.\d+)*$/.test(rubyVersion) return /^\d+(\.\d+)*$/.test(rubyVersion)
} }
export function isBundler1Default(engine, rubyVersion) {
return !isBundler2Default(engine, rubyVersion)
}
export function isBundler2Default(engine, rubyVersion) { export function isBundler2Default(engine, rubyVersion) {
if (engine === 'ruby') { if (engine === 'ruby') {
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7 return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7
Generated Vendored
+7 -2
View File
@@ -100,8 +100,8 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi
// Avoid installing a newer Bundler version for head versions as it might not work. // Avoid installing a newer Bundler version for head versions as it might not work.
// For releases, even if they ship with Bundler 2 we install the latest Bundler. // For releases, even if they ship with Bundler 2 we install the latest Bundler.
console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`) console.log(`Using Bundler 2 shipped with ${engine}-${rubyVersion}`)
} else if (engine === 'truffleruby' && !common.isHeadVersion(rubyVersion) && bundlerVersion.startsWith('1')) { } else if (engine === 'truffleruby' && common.isBundler1Default(engine, rubyVersion) && bundlerVersion.startsWith('1')) {
console.log(`Using Bundler 1 shipped with ${engine}`) console.log(`Using Bundler 1 shipped with ${engine}-${rubyVersion}`)
} else { } else {
const gem = path.join(rubyPrefix, 'bin', 'gem') const gem = path.join(rubyPrefix, 'bin', 'gem')
const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}` const bundlerVersionConstraint = bundlerVersion.match(/^\d+\.\d+\.\d+/) ? bundlerVersion : `~> ${bundlerVersion}`
@@ -229,6 +229,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 */ "isBundler1Default": () => (/* binding */ isBundler1Default),
/* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default), /* harmony export */ "isBundler2Default": () => (/* binding */ isBundler2Default),
/* harmony export */ "floatVersion": () => (/* binding */ floatVersion), /* harmony export */ "floatVersion": () => (/* binding */ floatVersion),
/* harmony export */ "hashFile": () => (/* binding */ hashFile), /* harmony export */ "hashFile": () => (/* binding */ hashFile),
@@ -296,6 +297,10 @@ function isStableVersion(rubyVersion) {
return /^\d+(\.\d+)*$/.test(rubyVersion) return /^\d+(\.\d+)*$/.test(rubyVersion)
} }
function isBundler1Default(engine, rubyVersion) {
return !isBundler2Default(engine, rubyVersion)
}
function isBundler2Default(engine, rubyVersion) { function isBundler2Default(engine, rubyVersion) {
if (engine === 'ruby') { if (engine === 'ruby') {
return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7 return isHeadVersion(rubyVersion) || floatVersion(rubyVersion) >= 2.7