Rbenv 1.0.0
github.com
github.com
I do get annoyed that "rvm list known" tends to only show old versions. For example, it suggests it can install ruby-2.2.1, but I'm fully aware 2.2.4 is available, as is ruby 2.3 now. And for me at least, this problem is consistent after applying the standard advice of "get the latest rvm".
In the case of a programming language runtime, if you have one project that's configured to use version 2.2.4 of a language and another that's configured to use version 2.1.0, these tools provide an easy way to install and switch between the two versions.
This is not unique to Ruby, and similar projects exist for other languages. For example, nvm (https://github.com/creationix/nvm) and n (https://github.com/tj/n) provide something similar for Node (JavaScript), gvm (https://github.com/moovweb/gvm) for Go, and multirust (https://github.com/brson/multirust) for Rust.
Is it truly a difference between the languages release strategy or is this just my perception because of limited experience with Ruby? I found it to be a huge pain in the ass.
The Ruby dev team tends to prefer encouraging the community to implement competing solutions rather than adopting any of them as official. Ruby devs in general tend to be members of the "there is more than one way to do it" camp.
There isn't really much of a "war". The different version managers came to an agreement on certain things like the format of .ruby-version files, so at this point it's a personal choice akin to which text editor you use.
https://github.com/regularfry/gemsh https://github.com/regularfry/rv
The wonderful thing is that these projects are so small and simple that writing your own tooling to interface with them feels quicker and easier than evaluating someone else's code...
In my mind, bundler was never really needed for that - it was a complexity step further than was required - so I never set myself up to rely on it, instead relying on a simpler mechanism which doesn't need runtime tooling support. As a result, I never have to run `bundle exec`. How much you might prefer this will probably be more dependent on how much you appreciate simplicity.
GP is right, there should really be one single, generic virtualenvwrapper-like tool that doesn't give a crap about languages.
RVM and rbenv seem like hacky solutions to a problem that is easily solved by specifying dependency versions in your project.
The same problem also occurs with libraries, which may also have their own executables, so these tools have tried to solve both problems - which is slightly more complicated than a three line shell script. Bundler has become the standard way of managing libraries, so now something like chruby[0] can be used to do pretty much what you said for the interpreter alone. Of course the other tools (that do a lot more) still have their historical followers...
If you are wondering why you need to support multiple versions, these tools are mainly for use in development environments where you will probably have to support legacy software that is no longer actively maintained.
[0] https://github.com/postmodern/chruby/blob/master/share/chrub...
As others mention, scripts typically just run "ruby" (via shebang or directly), which will pick whatever is the default.
Debian/Ubuntu have the "alternatives" system, which is designed to solve this for any kind of program, but it's virtually impossible to use by humans; there's no single command to switch between versions.
Fortunately, the ruby-switch package [1] wraps the terrible UI in a single command to switch versions. I highly recommend it.
Of course, this switches the version globally. To get per-shell Ruby versions, you will need the other tools mentioned in this thread.
Even if you're running an operation small enough that you can upgrade every single runtime in use all in one step, you'll still need to have two versions around while you test. But many, many places have to deal with multiple language versions simultaneously. E.g., if you maintain an open source library and have any regard for your users, you have to test how it behaves in multiple language versions.
(java is not fully backwards compatible either, but it may be a bit more tolerant in some cases)
As for how fun upgrading to rails4 is, you obviously don't have a project with 200 database tables that has models using the attr_protected for the five columns (appwide) that actually need it. Forced whitelisting is not fun, regardless of if it is on model or controller level.
> It should be simple to have multiple versions of libraries
> coexisting on a system.
This is a language issue, not a tooling issue.Why should I have to install a single library in multiple places in my system, if I have multiple versions of Ruby installed? It's a disaster for upgrades and deployment.
Plus, tools like RVM and rbenv seem to depend on a bunch of hacky symlinking and $PATH manipulation to make things work. Ensuring that developers' laptops have the same environment as production boxes is not trivial, no matter what the authors of these tools claim.
Edit: I probably shouldn't be surprised to learn that second hand information I picked up six years ago at PyCon is out of date...
Whereas with Ruby, I can't seem to get much working without it.
Hard to say the same with installing Python 3 on MacOSX and getting virtualenv running, which in my experience hasn't been so easy.
How would you work on a project that uses 3.2, then another that uses the latest features from 3.5, without pyenv?
At that point it should work invisibly in the virtualenv.
Unlike ruby, point releases don't often make sweeping breaking changes so it is often enough to say 'this is python 3 code' or 'this is python 2 > 2.5' code, so the granularity of something like pyenv is mostly unnecessary, imo.
You can't say this is Python 3 code or Python 2 code. That's completely false. If someone used latest features from Python 3.5 that wouldn't work on 3.4.
Also, I haven't had any issues upgrading point releases in Ruby(since 2.0). Point releases do not make sweeping changes by any means. You maybe talking about the weird 1.8 to 1.9.3 thing.
With virtualenv each project of mine has a requirements file (I use it even for Google App Engine development, having a distinct SDK per project) and runs Python from a different environment where the packages I install with pip do not interfere with any other environment. Without it an "apt-get upgrade" can end up breaking everything (to say nothing about not having the latest version packaged).
Actually, that would have been really handy about 5 years ago, but the point stands: the problem with general tools like Nix is that you need a popular, specific application of them to get them across the chasm. Not only would a wrapper script using Nix to manage ruby versions be actually useful, it ought to be relatively easy to repurpose to node, elixir, elm, GHC, whatever. Make it so that I don't need to care that I'm using Nix in the background, and I'm actually more likely to use it.