From 251b9047a8462bfe2705288cf750e63bbdf2f0be Mon Sep 17 00:00:00 2001 From: MSP-Greg Date: Wed, 27 Dec 2023 14:42:53 -0600 Subject: [PATCH] Fixup rubygems: latest to work with Rubies < 2.3 --- .github/workflows/test.yml | 1 + action.yml | 2 +- dist/index.js | 3 +++ rubygems.js | 3 +++ 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8249655..88a5dc0 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -181,6 +181,7 @@ jobs: - { ruby: '2.6', expected_rubygems_version: '3.4.22' } - { ruby: '2.5', expected_rubygems_version: '3.3.27' } - { ruby: '2.3', expected_rubygems_version: '3.3.27' } + - { ruby: '2.0', expected_rubygems_version: '2.7.11' } steps: - uses: actions/checkout@v4 - uses: ./ diff --git a/action.yml b/action.yml index 45c508b..e67fe6c 100644 --- a/action.yml +++ b/action.yml @@ -13,7 +13,7 @@ inputs: The version of RubyGems to use. Either 'default' (the default), 'latest', or a version number (e.g., 3.3.5). For 'default', no action is taken and the version of RubyGems that comes with Ruby by default is used. For 'latest', `gem update --system` is run to update to the latest compatible RubyGems version. - Ruby head/master builds and Ruby 2.2 and earlier will not be updated. + Ruby head/master builds will not be updated. Similarly, if a version number is given, `gem update --system ` is run to update to that version of RubyGems, as long as that version is newer than the one provided by default. bundler: description: | diff --git a/dist/index.js b/dist/index.js index 337f1d0..9b50b70 100644 --- a/dist/index.js +++ b/dist/index.js @@ -65133,6 +65133,9 @@ async function rubygemsLatest(gem, platform, engine, rubyVersion) { await exec.exec(gem, ['update', '--system', '3.4.22']) } else if (floatVersion >= 2.3) { await exec.exec(gem, ['update', '--system', '3.3.27']) + } else if (floatVersion >= 1.9) { + await exec.exec(`${gem} install rubygems-update -v 2.7.11 --no-document`) + await exec.exec('update_rubygems') } else { console.log(`Cannot update RubyGems for Ruby version ${rubyVersion}`) } diff --git a/rubygems.js b/rubygems.js index 16094d5..9048b8e 100644 --- a/rubygems.js +++ b/rubygems.js @@ -45,6 +45,9 @@ async function rubygemsLatest(gem, platform, engine, rubyVersion) { await exec.exec(gem, ['update', '--system', '3.4.22']) } else if (floatVersion >= 2.3) { await exec.exec(gem, ['update', '--system', '3.3.27']) + } else if (floatVersion >= 1.9) { + await exec.exec(`${gem} install rubygems-update -v 2.7.11 --no-document`) + await exec.exec('update_rubygems') } else { console.log(`Cannot update RubyGems for Ruby version ${rubyVersion}`) }