Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bugfix: Fix bug that version cannot be parsed in .tool-versions #720

Merged
merged 1 commit into from
Mar 11, 2025

Conversation

Karibash
Copy link
Contributor

@Karibash Karibash commented Mar 11, 2025

close: #719

This PR fixes a regression introduced in PR #717, where the tool fails to correctly parse the Ruby version from .tool-versions when multiple spaces exist between the tool name and version.

Copy link
Member

@eregon eregon left a comment

Choose a reason for hiding this comment

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

Thanks!

@eregon eregon merged commit 28233a0 into ruby:master Mar 11, 2025
@@ -130,7 +130,7 @@ function parseRubyEngineAndVersion(rubyVersion) {
} else if (rubyVersion === '.tool-versions') { // Read from .tool-versions
const toolVersions = fs.readFileSync('.tool-versions', 'utf8').trim()
const rubyLine = toolVersions.split(/\r?\n/).filter(e => /^ruby\s/.test(e))[0]
rubyVersion = rubyLine.split(/\s/)[1]
rubyVersion = rubyLine.split(/\s+/)[1]
Copy link
Member

@eregon eregon Mar 11, 2025

Choose a reason for hiding this comment

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

It makes me think we should really do https://github.com/ruby/setup-ruby/pull/717/files#r1982040471 but I merged this as-is to fix it ASAP.
We should also add a test for .tool-versions

Copy link
Member

Choose a reason for hiding this comment

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Unable to Parse Ruby Version from .tool-versions Since v1.222.0
2 participants