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

Support ruby-build ruby-X.Y.Z DIR #2448

Merged
merged 6 commits into from
Sep 23, 2024

Conversation

eregon
Copy link
Member

@eregon eregon commented Sep 23, 2024

  • By searching a X.Y.Z definition if no ruby-X.Y.Z definition is not found.

So this enables for example:

$ ruby-build ruby-3.3.5 PREFIX

And with #2447 it enables:

$ ruby-build -d ruby-3.3.4 ~/.rubies
...
==> Installed ruby-3.3.4 to /home/eregon/.rubies/ruby-3.3.4

It would remove the need for https://github.com/ruby/ruby-builder/blob/135bc7c215df24a672d0735189aafc510923d380/.github/workflows/build.yml#L67-L74 and likely other places working around the "asymmetry" that CRuby definitions don't have a prefix.

@eregon eregon requested a review from mislav September 23, 2024 10:19
* By searching a X.Y.Z definition if no ruby-X.Y.Z definition is not found.
@eregon eregon force-pushed the accept-ruby-prefix-for-definition branch from 30d5393 to 49dd050 Compare September 23, 2024 10:19
Copy link
Member

@mislav mislav left a comment

Choose a reason for hiding this comment

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

I think some feature in this direction would be great; thank you.

But first of all: without #2447 I don't think this feature makes sense on its own, so I would even suggest lumping it together in a single PR rather that treating them as distinct features. WDYT?

Second, if ruby-build 3.3.4 ... and ruby-build ruby-3.3.4 ... are basically equivalent invocations since they resolve to the same version of CRuby, should they be guaranteed to be completely interchangeable? I'm asking because it seems that if you add the -d option to this invocation, you will end up with different installation prefixes based on your argument input. That seems slightly wrong to me because I think it could be seen as counter-intuitive.

@eregon
Copy link
Member Author

eregon commented Sep 23, 2024

But first of all: without #2447 I don't think this feature makes sense on its own, so I would even suggest lumping it together in a single PR rather that treating them as distinct features. WDYT?

It's how I had it locally but I figured it's easier to review independently, and this change has value on its own (first example and last paragraph of the description).
I can move it to #2447, or we can just merge both PRs, as you prefer, let me know.

I'm asking because it seems that if you add the -d option to this invocation, you will end up with different installation prefixes based on your argument input.

Indeed it will install to either $PREFIX/3.3.4 or $PREFIX/ruby-3.3.4.
What I would like to achieve is to install to $PREFIX/ruby-3.3.4 with the -d option.
I can see both sides:

  • It installs to $PREFIX/$(first argument passed to ruby-build) (current behavior on the PR)
  • ruby-X.Y.Z is resolved to X.Y.Z earlier, but then this could be a compatibility issue if someone has a custom definition matching ^ruby-[0-9] as then it wouldn't be picked anymore. So that's why I didn't go that way.

Copy link
Member

@mislav mislav left a comment

Choose a reason for hiding this comment

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

Thanks!

Added some tests and documentation updates. Feel free to merge when all looks good to you 🙏

@eregon
Copy link
Member Author

eregon commented Sep 23, 2024

Amazing, thank you!

@eregon eregon merged commit a22ff72 into rbenv:master Sep 23, 2024
4 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.

2 participants