Skip to content

Use ruby's Gem::Version instead of npm's semver to parse rubygems version - #946

Merged
eregon merged 1 commit into
ruby:masterfrom
ntkme:gem-version
Oct 19, 2026
Merged

eregon merged 1 commit into
ruby:masterfrom
ntkme:gem-version

Conversation

@ntkme

@ntkme ntkme commented Oct 9, 2026

Copy link
Copy Markdown
Collaborator

@ntkme
ntkme requested a review from eregon October 9, 2026 18:21
@ntkme
ntkme force-pushed the gem-version branch 2 times, most recently from a86e223 to 907bc9a Compare October 9, 2026 19:08
@ntkme

ntkme commented Oct 19, 2026

Copy link
Copy Markdown
Collaborator Author

@enebo Can you please review this when you have a chance?

@eregon eregon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks!

Comment thread rubygems.js
async function compareGemVersion(a, b, rubyPrefix) {
const ruby = path.join(rubyPrefix, 'bin', 'ruby')

const { stdout } = await exec.getExecOutput(ruby, ['-e', 'puts Gem::Version.new(ARGV[0]) <=> Gem::Version.new(ARGV[1])', '--', a, b])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Calling ruby an extra time for this might take some time, OTOH updating RubyGems is not super fast so this seems fine.

Comment thread package.json
"@actions/io": "^2.0.0",
"@actions/tool-cache": "^3.0.0",
"linux-os-info": "^2.0.0",
"semver": "^7.7.3"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, one less dependency

@eregon
eregon merged commit 824c0e2 into ruby:master Oct 19, 2026
473 of 474 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Can't install prerelease RubyGems

2 participants