From c40ce85201dc1277b424f20b6960a18b54277520 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Fri, 3 Apr 2020 23:58:23 +0200 Subject: [PATCH] Do not install Bundler 2 for ruby-head since it already ships a version that might work better --- dist/index.js | 8 +++++++- index.js | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index 2f9bef7..4ef0ee9 100644 --- a/dist/index.js +++ b/dist/index.js @@ -1115,7 +1115,9 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) { if (engine === 'rubinius') { console.log(`Rubinius only supports the version of Bundler shipped with it`) - } else if (bundlerVersion === '1' && engine === 'truffleruby') { + } else if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') { + console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`) + } else if (engine === 'truffleruby' && bundlerVersion === '1') { console.log(`Using the Bundler version shipped with ${engine}`) } else { const gem = path.join(rubyPrefix, 'bin', 'gem') @@ -1123,6 +1125,10 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) { } } +function isHeadVersion(rubyVersion) { + return rubyVersion === 'head' || rubyVersion === 'mingw' || rubyVersion === 'mswin' +} + function getVirtualEnvironmentName() { const platform = os.platform() if (platform === 'linux') { diff --git a/index.js b/index.js index 7f942a6..f77e0bf 100644 --- a/index.js +++ b/index.js @@ -157,7 +157,9 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) { if (engine === 'rubinius') { console.log(`Rubinius only supports the version of Bundler shipped with it`) - } else if (bundlerVersion === '1' && engine === 'truffleruby') { + } else if (engine === 'ruby' && isHeadVersion(rubyVersion) && bundlerVersion === '2') { + console.log(`Using the Bundler version shipped with ${engine}-${rubyVersion}`) + } else if (engine === 'truffleruby' && bundlerVersion === '1') { console.log(`Using the Bundler version shipped with ${engine}`) } else { const gem = path.join(rubyPrefix, 'bin', 'gem') @@ -165,6 +167,10 @@ async function installBundler(platform, rubyPrefix, engine, rubyVersion) { } } +function isHeadVersion(rubyVersion) { + return rubyVersion === 'head' || rubyVersion === 'mingw' || rubyVersion === 'mswin' +} + function getVirtualEnvironmentName() { const platform = os.platform() if (platform === 'linux') {