Skip to content

Conversation

@tvon
Copy link

@tvon tvon commented Jan 31, 2015

This is based off of #319

Addresses #318

  • Breaks out ruby selection into function for testing.
  • Removes *"$1"* matching and adds ruby-"$1"* and "$1"* matching.

For example, given the following:

RUBIES=(
  /opt/rubies/ruby-2.0.0-p100
  /opt/rubies/ruby-2.1.1
  /opt/rubies/ruby-2.2.0
  /opt/rubies/ruby-2.2.1
  /opt/rubies/rbx-2.2.0
  /opt/rubies/rbx-2.2.1
)
  • 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

2.0.0-p353 is no longer available on the rvm servers.

http://rvm.io/binaries/osx/10.10/x86_64/
Addresses postmodern#318

* Breaks out ruby selection into function for testing.
* Removes `*"$1"*` matching and adds `ruby-"$1"*` and `"$1"*` matching.
@tvon tvon force-pushed the 318-version-matching branch from 548e628 to a6f4763 Compare January 31, 2015 16:06
@jrafanie
Copy link

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.

@tvon
Copy link
Author

tvon commented Mar 13, 2015

@postmodern anything I can do to improve this?

@postmodern
Copy link
Owner

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.

@tvon
Copy link
Author

tvon commented Mar 17, 2015

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.

@alindeman
Copy link

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.

@ccutrer
Copy link

ccutrer commented May 29, 2015

@postmodern any update on this? @tvon's reasoning on matching ruby-$1* rather than *-$1* seems pretty convincing to me.

@FranklinYu
Copy link
Contributor

@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.

@tvon tvon closed this Jan 15, 2020
@tvon tvon deleted the 318-version-matching branch January 15, 2020 03:24
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.

7 participants