zsljulius
zsljulius

Reputation: 4103

How rvm manages Gem/gemsets

I am wondering how RVM manages the gem/gemsets. For instance, I have by default been using ruby 1.9.2@global and installed rails 3.1.3 in this environment. Later I copied a rails project from other, which is based on rails 3.0.10. By cd into the folder, I ran rails -v, it recommended me to run bundle install. I did so. After this, lots of gems were installed including rails 3.0.10. But when I do rvm 1.9.2 do gemset list, there is no new gemset( this is expected though). Then how do I manage the two versions of rails?

Thank you in advance

Upvotes: 1

Views: 190

Answers (1)

Pedro Nascimento
Pedro Nascimento

Reputation: 13886

You can have more than one path into your Gem.path.

Try running ruby -r rubygems -e "p Gem.path" and check the output, you'll see that both @global and your current gemset are included.

Rubygems use the $GEM_PATH variable to figure out where to look/install gems, and that's one of the things RVM sets when you change a ruby version/gemset.

Also, it might be worth to look at a few environment variables RVM sets. Run this:

env | grep -i rvm||path

There might be a few extra ones (including $PATH), but you'll general you'll see a lot of RVM environment variables.

That's why some people like rbenv, a simpler way to manage ruby versions.

Upvotes: 1

Related Questions