I want to type rbenv install 1.9.3 and newest version of ruby 1.9.3 should be installed.
rbenv install 1.9.3
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.
Also, cancel installation if ruby version with provided prefix has been installed before.
Sounds like rbenv/rbenv#328 "Support for abbreviated ruby version in .ruby-version file"
I may understand why rbenv should not support that similar feature, but I don't know why ruby-build shouldn't this one.
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).
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.
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.
rbenv install stable
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.
ruby-build --definitions | grep 1.9.3-p[0-9] | tail -1
yea, I just think this kind of logic belongs in the script that is managing ruby versions already.
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.
I guess keeping ruby-build completely version agnostic is worth the extra hassle, I'll quit being lazy.
@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.
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.
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.