From a0d08243d4c6736c034018b67373bc4f399614a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 16 Jul 2025 11:55:37 +0200 Subject: [PATCH 1/3] Add workaround for Ruby 3.1 after RubyGems 3.7.0 release --- dist/index.js | 4 +++- rubygems.js | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/dist/index.js b/dist/index.js index d231f96b0..9d18b0420 100644 --- a/dist/index.js +++ b/dist/index.js @@ -71454,8 +71454,10 @@ async function rubygemsLatest(gem, platform, engine, rubyVersion) { const floatVersion = common.floatVersion(rubyVersion) if (common.isHeadVersion(rubyVersion)) { console.log('Ruby master builds use included RubyGems') - } else if (floatVersion >= 3.1) { + } else if (floatVersion >= 3.2) { await exec.exec(gem, ['update', '--system']) + } else if (floatVersion >= 3.1) { + await exec.exec(gem, ['update', '--system', '3.6.9']) } else if (floatVersion >= 3.0) { await exec.exec(gem, ['update', '--system', '3.5.23']) } else if (floatVersion >= 2.6) { diff --git a/rubygems.js b/rubygems.js index f96cfca62..9c4609c54 100644 --- a/rubygems.js +++ b/rubygems.js @@ -39,8 +39,10 @@ async function rubygemsLatest(gem, platform, engine, rubyVersion) { const floatVersion = common.floatVersion(rubyVersion) if (common.isHeadVersion(rubyVersion)) { console.log('Ruby master builds use included RubyGems') - } else if (floatVersion >= 3.1) { + } else if (floatVersion >= 3.2) { await exec.exec(gem, ['update', '--system']) + } else if (floatVersion >= 3.1) { + await exec.exec(gem, ['update', '--system', '3.6.9']) } else if (floatVersion >= 3.0) { await exec.exec(gem, ['update', '--system', '3.5.23']) } else if (floatVersion >= 2.6) { From f66e1124dc15658333003d8edd60c3ed913dd8a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 16 Jul 2025 12:11:35 +0200 Subject: [PATCH 2/3] Don't use `--force` flag on Windows It was originally added by https://github.com/ruby/setup-ruby/pull/253, in order to fix CI. However, now CI passes without it so I assume this was fixed by rubyinstaller2. Force actually bypasses dependency constraints so it's actually installing the latest Bundler in a version of Ruby that's incompatible with it. --- bundler.js | 3 +-- dist/index.js | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/bundler.js b/bundler.js index 8c945d6e0..e76615127 100644 --- a/bundler.js +++ b/bundler.js @@ -137,9 +137,8 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock } const gem = path.join(rubyPrefix, 'bin', 'gem') - // Workaround for https://github.com/rubygems/rubygems/issues/5245 // and for https://github.com/oracle/truffleruby/issues/2780 - const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : [] + const force = engine === 'truffleruby' ? ['--force'] : [] const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` diff --git a/dist/index.js b/dist/index.js index 9d18b0420..71529bede 100644 --- a/dist/index.js +++ b/dist/index.js @@ -151,9 +151,8 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p } const gem = path.join(rubyPrefix, 'bin', 'gem') - // Workaround for https://github.com/rubygems/rubygems/issues/5245 // and for https://github.com/oracle/truffleruby/issues/2780 - const force = ((platform.startsWith('windows-') && engine === 'ruby' && floatVersion >= 3.1) || (engine === 'truffleruby')) ? ['--force'] : [] + const force = engine === 'truffleruby' ? ['--force'] : [] const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` From 472790540115ce5bd69d399a020189a8c87d641f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Wed, 16 Jul 2025 22:44:41 +0200 Subject: [PATCH 3/3] Try also removing the other case where `--force` is used --- bundler.js | 4 +--- dist/index.js | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/bundler.js b/bundler.js index e76615127..711871bae 100644 --- a/bundler.js +++ b/bundler.js @@ -137,13 +137,11 @@ export async function installBundler(bundlerVersionInput, rubygemsInputSet, lock } const gem = path.join(rubyPrefix, 'bin', 'gem') - // and for https://github.com/oracle/truffleruby/issues/2780 - const force = engine === 'truffleruby' ? ['--force'] : [] const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` - await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint]) + await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) return bundlerVersion } diff --git a/dist/index.js b/dist/index.js index 71529bede..b03752c56 100644 --- a/dist/index.js +++ b/dist/index.js @@ -151,13 +151,11 @@ async function installBundler(bundlerVersionInput, rubygemsInputSet, lockFile, p } const gem = path.join(rubyPrefix, 'bin', 'gem') - // and for https://github.com/oracle/truffleruby/issues/2780 - const force = engine === 'truffleruby' ? ['--force'] : [] const versionParts = [...bundlerVersion.matchAll(/\d+/g)].length const bundlerVersionConstraint = versionParts >= 3 ? bundlerVersion : `~> ${bundlerVersion}.0` - await exec.exec(gem, ['install', 'bundler', ...force, '-v', bundlerVersionConstraint]) + await exec.exec(gem, ['install', 'bundler', '-v', bundlerVersionConstraint]) return bundlerVersion }