Rvm vs RBENV
by Sean Hagstrom
What is RVM?
- An acronym that stands for, "Ruby enVironment Manager".
- A tool used to ...
-
Install multiple versions of Ruby.
- Manage multiple versions of Ruby.
- Create Gem enclosures.
What is RBENV?
- A modular approach to a Ruby Version Manager.
- Another tool for...
- Installing multiple versions of Ruby. *
- Managing multiple versions of Ruby.
- Creating Gem enclosures. *
* - Needs a package for that.
WHO should use these tools?
Short Answer
You
Longer Answer
Ruby Developers,
Who have ever needed multiple versions of
Ruby on one machine or separate Gem environments.
But Please, tell me Why.
Well...
Environment managers take away a lot of the pain.
Instead of having issues with conflicting Gem versions,
Or having to run several virtual machines to work on many versions of Ruby or Gems.
You can use a Ruby Environment Manager.
Well why not have both? I guess.
RVM
\curl -L https://get.rvm.io | bash
DON't DO THAT!
Rbenv for the non MAC OSX
- Git Clone repo into .rbenv directory
- Add a couple of new lines to your
- bashrc or zshrc
- bash_profile or z_profile
More information
https://github.com/sstephenson/rbenv
using these Tools
Q:
How do I switch Ruby Versions?
Q:
Are there any tips or tricks?
Switching Versions
It's pretty easy
RVM
rvm install x.x.x
rvm use x.x.x
RBENV *
rbenv install ruby-x.x.x
rbenv local x.x.x
* = ruby-build package needed for compiling
GEMSETS
Q:
What is a Gemset?
A:
A self-contained Ruby setup that can
separate Ruby, Gems, and IRB
from the system and each other.
Q:
I've heard of these, I heard Bundler
killed them, is that true?
Gemsets
Configuration
RVM
rvm x.x.x@gemset_name --create
RBENV *
rbenv gemset create x.x.x gemset_name
echo gemset_name > .rbenv-gemset
* = rbenv-gemset package needed for gemsets
Environment Files
Environment files can be used to set the Ruby version and Gemset for project directories.
Example
rvm x.x.x@gemset_name --create --rvmrc
rvm rvmrc to .ruby-version
Results
cd ../ # gives the directory above or global ruby version and gemset.
cd project_name/ # gives you the environment file ruby version and gemset.
SOunds good, but what's the catch
RVM
- Overrides the "cd" and "gem" commands.
- Makes "cd" and "gem"take longer .
- Has trust issues.
RBENV
- "shims" have to wrap most of your gems.
- Makes all Ruby commands take longer.
- Has you call "rbenv rehash".
There's a new Challenger
CHRUBY!
The new kid that's keeping things simple and clean?
Maybe so, but it definitely has a lot of support from former Ruby Version Managers.
To this date is has earned the respect from.
RubyFu & Ruby-Version