From 4726835508d9debb3220096c92d7bf6388485faa Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Mon, 10 Jan 2022 16:48:56 +0100 Subject: [PATCH] Try 'gem install --force bundler' on 3.1 Windows --- bundler.js | 4 +++- dist/index.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bundler.js b/bundler.js index b5a8a49..9e2b962 100644 --- a/bundler.js +++ b/bundler.js @@ -91,7 +91,9 @@ export async function installBundler(bundlerVersionInput, lockFile, platform, ru } else { const gem = path.join(rubyPrefix, 'bin', 'gem') const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}` - await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) + // Workaround for https://github.com/rubygems/rubygems/issues/5245 + const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : [] + await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint]) } return bundlerVersion diff --git a/dist/index.js b/dist/index.js index 3ffde5c..5b11c2c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -105,7 +105,9 @@ async function installBundler(bundlerVersionInput, lockFile, platform, rubyPrefi } else { const gem = path.join(rubyPrefix, 'bin', 'gem') const bundlerVersionConstraint = /^\d+\.\d+\.\d+/.test(bundlerVersion) ? bundlerVersion : `~> ${bundlerVersion}` - await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) + // Workaround for https://github.com/rubygems/rubygems/issues/5245 + const force = (platform.startsWith('windows-') && engine === 'ruby' && common.floatVersion(rubyVersion) >= 3.1) ? ['--force'] : [] + await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint]) } return bundlerVersion