Closed tvon closed 4 years ago
Thank you for chruby/ruby-install.
As a user, this PR is great. I love chruby and recommend it to my team but dislike the current behavior. What's needed to get this reviewed/merged?
I get burned by this all the time when I install new rubies. Currently chruby 2.1 selects 2.2.1 when I want 2.1.5. Previously, chruby 2.0 selected 2.2.0 instead of 2.0.0. My brain just doesn't grok the current behavior.
I've considered removing rubies locally just so I don't have to deal with this problem but that seems silly.
@postmodern anything I can do to improve this?
I'm a little hesitant about preferring ruby-$1*
over just -$1*
. See #278 which better sorts rubies by their version. I also experimented with adding precedence to matching.
My reasoning for ruby-*
is that the only time people omit the implementation is when using MRI, at least so far as I've seen. In other words, if there is only a version number specified then we're looking for ruby-*
, if there is more specified (rbx-2.2
) then the "$1"*
match will catch it. Unless I'm missing something, *-$1
could match 2.1
to rbx-2.1.1
which would be a mistake (I'm assuming even the Rubinius developers don't expect 2.1
to mean rbx-2.1
).
Sorting would be an improvement either way as this PR does nothing to ensure that 2.1
picks the latest 2.1.x
, but without other changes I don't think it would address 2.1
matching 2.2.1
instead of 2.1.x
.
chruby 2.1
selecting 2.2.1
is pretty confusing to me. I don't doubt there are some complicated issues around version preference, but this specific case is very surprising to me.
@postmodern any update on this? @tvon's reasoning on matching ruby-$1*
rather than *-$1*
seems pretty convincing to me.
@postmodern Any update on this? When typing 2.1
I also expect ruby-2.1.1
(or the latest version of 2.1) while I would include the implementation if I am not using MRI, as stated by @tvon.
This is based off of https://github.com/postmodern/chruby/pull/319
Addresses #318
*"$1"*
matching and addsruby-"$1"*
and"$1"*
matching.For example, given the following:
chruby ruby-2.2
selects/opt/rubies/ruby-2.2.1
chruby rbx
selects to/opt/rubies/rbx-2.2.1
chruby 2.1
selects to/opt/rubies/ruby-2.1.1
, this is the only change in the current behavior. In master this would select/opt/rubies/ruby-2.2.1