Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RVM per project gemsets

I'm having difficulty understanding RVM per project gemsets. I've installed RVM and the 1.9.2 and 1.8.7 rubies, as per http://beginrescueend.com/interpreters/ruby/ , and when I want to start a new project, I've been

cd ~/Code
rvm use 1.9.2
rvm gemset create test1
rvm gemset use test1
gem install rails

But this takes a long time! (installing rails). I then rails new test1; cd test1

I'm really unsure with the correct workflow. If I'm making a new app to test in, I don't want to have to wait for rails to install.

It seems from http://beginrescueend.com/gemsets/basics/ that I can create a rails gemset, but then how do I create a per project gemset?

Edit:

If I'm going to using multiple ruby/rails versions, should I create a gemset, say 1.9.2@rails313, then rails new blah, put 1.9.2@rails313 in blah/.rvmrc , and if I need to later on, create a blah gemset?

like image 827
Zeophlite Avatar asked Dec 22 '22 04:12

Zeophlite


1 Answers

A gemset is just a container you can use to keep gems separate from each other.

The Big Idea: creating a gemset per project allows you to change gems (and gem versions) for one project without breaking all your other projects. Each project need only worry about its own gems. This is a Good Idea, and the wait time for installing large gems like Rails is usually worth it.

That said, if you're going to use the same version of Rails across all your projects and want to save time, you can install rails (and maybe rake as well) in the 'global' gemset - these gems are available in all gemsets for that version of ruby.

Assuming you already have a test1 gemset:

$ rvm gemset use global
$ gem install rails
$ gem install rake
$ rvm gemset use test1
$ rails test1
like image 195
andrewdotnich Avatar answered Jan 02 '23 03:01

andrewdotnich