Suport prefix matching on ruby versons. #276

Closed
sheerun opened this Issue Feb 4, 2013 · 13 comments

Projects

None yet

7 participants

@sheerun
Contributor
sheerun commented Feb 4, 2013

I want to type rbenv install 1.9.3 and newest version of ruby 1.9.3 should be installed.

The general pattern is:

rbenv install 1.9       # installs 1.9.3-p374 (newest stable 1.9 one)
rbenv install 1.9.2     # installs 1.9.2-p320 (newest stable 1.9.2 one)
rbenv install jruby-1.7 # installs jruby-1.7.2 (newest stable jruby-1.7)
rbenv install maglev    # installs maglev-1.0.0 (newest stable maglev)
rbenv install ree       # installs ree-1.8.7-2012.02 (guess why)

PLEASE safe me copying and pasting, and approve this feature. Rbenv is not just for server.

@sheerun
Contributor
sheerun commented Feb 4, 2013

Also, cancel installation if ruby version with provided prefix has been installed before.

@nihilismus

Sounds like rbenv/rbenv#328 "Support for abbreviated ruby version in .ruby-version file"

@sheerun
Contributor
sheerun commented Feb 6, 2013

I may understand why rbenv should not support that similar feature, but I don't know why ruby-build shouldn't this one.

@bensie
Contributor
bensie commented Feb 6, 2013

The only job of ruby-build is to install rubies. Keeps it dead simple. It doesn't know or care about what is the latest, and certainly doesn't determine any level of stability for a given major version (prerelease vs rc vs official release).

@fschwahn
fschwahn commented Feb 6, 2013

I think the same argument which is being made for rbenv holds here. You can avoid copy/pasting by using the shell completion rbenv-install provides.

@nixpulvis

I'm currently using rbenv to bootstrap fresh computers with needed tools, being able to write something like rbenv install 1.9.3 or even rbenv install stable would be very nice, to avoid having to update my script everytime ruby is updated.

@jeremy
Collaborator
jeremy commented Feb 10, 2013

You could use ruby-build --definitions | grep 1.9.3-p[0-9] | tail -1 in your build script to grab the latest 1.9.3 patchlevel.

@nixpulvis

yea, I just think this kind of logic belongs in the script that is managing ruby versions already.

@jeremy
Collaborator
jeremy commented Feb 10, 2013

That's just the thing: ruby-build is version agnostic. From its point of view, these are arbitrary identifiers associated with a build definition. It doesn't distinguish later versions from earlier, or know about the difference between a release, preview/rc, and dev versions.

@nixpulvis

I guess keeping ruby-build completely version agnostic is worth the extra hassle, I'll quit being lazy.

@jeremy jeremy closed this Feb 10, 2013
@sferik
Collaborator
sferik commented Feb 10, 2013

@nathan You might be happier using chruby with ruby-build (instead of rbenv).

I agree with @jeremy that this feature is outside the scope of ruby-build.

@nixpulvis

It's not worth switching away from rbenv just for this. I'm just going to implement a little logic to get the current stable version for my build script. Not a huge deal.

@ghost
ghost commented May 12, 2015

If someone is looking for a way to install the latest stable version of MRI using rbenv, I have a Stack Overflow question about it: http://stackoverflow.com/questions/30179484/make-shell-script-install-latest-stable-version-of-ruby-using-rbenv/301798499

Hope it helps anyone writing custom Bash install scripts.

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