Skip to content

Commit

Permalink
Rename workflow and variable for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon committed Dec 27, 2023
1 parent 28f9302 commit 961f851
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ jobs:
- run: ruby -v

testLatestRubygemsVersion:
name: "Ruby ${{ matrix.ruby }}: latest upgrades RubyGems"
name: "Test rubygems: latest on Ruby ${{ matrix.ruby }}"
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand Down
18 changes: 9 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions rubygems.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const path = require('path')
const exec = require('@actions/exec')
const semver = require('semver')

export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform, engine, version) {
export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform, engine, rubyVersion) {
const gem = path.join(rubyPrefix, 'bin', 'gem')

let gemVersion = ''
Expand All @@ -19,7 +19,7 @@ export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform,

if (rubygemsVersionInput === 'latest') {
console.log('Updating RubyGems to latest version')
await rubygemsLatest(gem, platform, engine, version)
await rubygemsLatest(gem, platform, engine, rubyVersion)
} else if (semver.gt(rubygemsVersionInput, gemVersion)) {
console.log(`Updating RubyGems to ${rubygemsVersionInput}`)
await exec.exec(gem, ['update', '--system', rubygemsVersionInput])
Expand All @@ -34,19 +34,19 @@ export async function rubygemsUpdate(rubygemsVersionInput, rubyPrefix, platform,
// running 'gem update --system', so we have to force a compatible version of
// rubygems-update. See https://github.com/ruby/setup-ruby/pull/551 and
// https://github.com/rubygems/rubygems/issues/7329
async function rubygemsLatest(gem, platform, engine, version) {
async function rubygemsLatest(gem, platform, engine, rubyVersion) {
if (engine === 'ruby') {
const rubyFloatVersion = common.floatVersion(version)
if (common.isHeadVersion(version)) {
const floatVersion = common.floatVersion(rubyVersion)
if (common.isHeadVersion(rubyVersion)) {
console.log('Ruby master builds use included RubyGems')
} else if (rubyFloatVersion >= 3.0) {
} else if (floatVersion >= 3.0) {
await exec.exec(gem, ['update', '--system'])
} else if (rubyFloatVersion >= 2.6) {
} else if (floatVersion >= 2.6) {
await exec.exec(gem, ['update', '--system', '3.4.22'])
} else if (rubyFloatVersion >= 2.3) {
} else if (floatVersion >= 2.3) {
await exec.exec(gem, ['update', '--system', '3.3.27'])
} else {
console.log(`Cannot update RubyGems for Ruby version ${version}`)
console.log(`Cannot update RubyGems for Ruby version ${rubyVersion}`)
}
} else {
// non MRI Rubies (TruffleRuby and JRuby)
Expand Down

0 comments on commit 961f851

Please sign in to comment.