You’d miss all the interesting and informative discussion, but if you like, you can skip to the answer.
Long story but I recently switched my primary Rails 3 development platform from Aptana Studio 3 to Sublime Text 2. And this is how it goes with Rails development… you want to change editors, and a key capability requires changing how you load Ruby Gems, which affects how you deploy your applications, which affects how you set up your servers. And so on. This was no exception.
Argghhh (1)
One nice feature I was interested in setting up was the ability to run tests from the ST2 edit pane using Ruby Tests. Of course, it didn’t work. After too-much research, I realized that Ruby Tests doesn’t work with RVM (Ruby Version Manager,) which I was using to manage different Ruby version on the development machine. I was encouraged to try rbenv instead, because it was “less intrusive.” So I did.
The result was that Ruby Tests still did not work, unless I started ST2 from the command line from the rails project directory. That’s a PITA and if I am going to do that I might as well run tests from the command line directly. So I dropped RubyTests. Not worth the trouble.
Argghhh (2)
Fine. A new editor I liked better, and back to using the command line for running tests. Reasonable.
But then I tried to deploy the app. I am using Capistrano for deployment, and it turns out that rbenv doesn’t work with Capistrano! Now wouldn’t that be a nice thing to mention in the rbenv readme page?
The solution:
Another day or two screwing with this and we agreed on this setup.
- I am using Sublime Text 2 as my development environment/editor (I’m developing on a Mac.) Be sure to install the Package Control package for easy access to most of the additional packages you’ll want to load.
- I use the command line for git operations and for rspec testing. Both are worth learning, and once you know how to use these tools from the command line, other interfaces will seem unnecessary.
- I am using rbenv now, but I don’t think it’s better than RVM, just a different solution. And we’re NOT using gemsets. If you use Bundler, there’s no reason to mess around with multiple gemsets at all.
- In the past, a server was most likely a real machine somewhere. It was expensive and there was motivation to run multiple applications rather than deploy a new server for each app. Now we’re using RackSpace (disclosure: that’s an affiliate link) and we can spin up a development server by the hour for about $0.50 per day, and we can scale it up as required for production. For our needs, there’s no reason to run multiple apps on a server… or multiple versions of Ruby.
I don’t want to sound ungrateful, because all of this software is great, and it’s provided free of charge (except ST2, which is well worth the registration fee.) But at some point I would hope that authors, or perhaps the community, would warn against obvious and time-consuming dead ends. It would sure be nice if RubyTests said at the outset it doesn’t work right with RVM, and best case, it requires an annoying command line startup sequence. If I knew those basics from the start, I could have saved a day or more of work screwing with it. And it would sure be nice if rbenv said at the outset it would not work with Capistano deployments. That is, with rbenv on the server and the settings/state deployed via Capistrano. So it goes.
So the answer to “RVM or rbenv or ???”
It doesn’t matter. rbenv and RVM both work fine for development. But make sure you know why you want to support multiple Ruby versions on your development machine before adding another layer of stuff.
And don’t install multiple versions of Ruby on your production machines at all.
(period.)