-
Notifications
You must be signed in to change notification settings - Fork 785
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
Add -d, --dir option to install to <prefix>/<definition> instead of <prefix> #2447
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this!!
@@ -8,6 +8,7 @@ | |||
# --definitions List all local definitions, including outdated ones | |||
# --version Show version of ruby-build | |||
# | |||
# -d, --dir Install the Ruby in <prefix>/<definition> instead of <prefix> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My nitpick is that maybe this flag should receive a value instead of being a boolean flag.
When I see an invocation like this:
ruby-build 3.2.1 --dir ~/.rubies
it would seem to me like the --dir
flag is passed a value of ~/.rubies
, but that's not how this is implemented right now. This would likely work: ruby-build --dir 3.2.1 ~/.rubies
, and so would this: ruby-build 3.2.1 ~/.rubies --dir
, but I do not think these invocations should work because they look "wrong" and I believe that they should error out. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried to fit the existing usage ruby-build [-kpv] <definition> <prefix>
.
If the prefix becomes optional it feels like opening Pandora's box, so that's why I preferred an option without a value. Also it seems currently ruby-build doesn't have any option taking an argument, and I would like to avoid having to add that.
I think all 3 variants you showed are fine to use.
I used --dir
in the example because it works and looks cool, but ruby-build --dir 3.2.1 ~/.rubies
is just as fine.
I'm happy to update the PR's description if that helps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually I should update the usage line to ruby-build [-kpvd]
and then the documented way to use this is ruby-build -d definition prefix
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the usage line and the PR descriptions to use ruby-build -d
.
The fact -d
in the middle works is then like an easter egg.
BTW, what do you think about this potential feature being lumped in with all the others, while we're going in this direction: ruby-build truffleruby+graalvm -d ~/.rubies
#=> (installs the latest "truffleruby+graalvm" version) |
It seems nice to have but that feels out of scope and I don't really have time to look into that. I don't really need it either. |
…prefix> * Similar to ruby-install's -r, --rubies-dir flag.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
I've added a man page entry and a test.
Thank you! |
So this enables for example:
Which I find quite convenient compared to having to copy-paste the definition names after the rubies directory.