I am wondering what is the best practice for using gemsets with rails
projects.
What is the correct workflow for developing multiple rails3 projects
each with its own gemset. SPECIFICALLY I am not sure where I do a "gem
install rails" when I will have more than one rails project. Do I need
to "gem install rails" in each gemset? Or can I "gem install rails" in
a directory named [say] ~/work/rail3...
WORKFLOW
In ~/work/rails3 I do
rvm use ree@global
gem install rails
This installs rails3 in global gemset
Now... In ~/work/rails3 I can
rails new blog
This will create the rails directory structure in ~/work/rails3/blog
So... now I am in ~/work/rails3/blog and I want a gemset for this
project
So should I...
rvm gemset create blog
rvm use ree@blog
.... but I did "gem install rails" in @global and I am now one
directory deeper and in @blog so rails gems are not in there...
correct? Do I need to do a "gem install rails" in @blog?
I feel I am not getting the workflow correct for using RVM and
rails....
I am wondering what is the best practice for using gemsets with rails
projects.
No idea if it's best practice, but I create a gemset for every project. Then in the rails root of that project put "rvm gemset use xxxx" in .rvmrc so every time I cd into that directory it's loaded.
For gems you always want installed in new gemsets look in ~/.rvm/gemsets/ at default.gems and global.gems.
I *wouldn't* put Rails in there though... what if you have to work on an old rails 2 project? I put bundler, rake, and open_gem in mine as I use those all the time....
THere's probably better info on the RVM website about all this...
What I am still not getting is where I should have the rails gem
installed? In my root "work" directory I need to be able to run
"rails new projectname". So that creates a new directory "work/
projectname" ... but using rvm the rails gem is not in this directory
when I make a .rvmrc for this project.
It just seems odd to me to have to keep doing gem install rails... I
feel like I am missing something?
What I am still not getting is where I should have the rails gem
installed? In my root “work” directory I need to be able to run
“rails new projectname”. So that creates a new directory "work/
projectname" … but using rvm the rails gem is not in this directory
when I make a .rvmrc for this project.
It just seems odd to me to have to keep doing gem install rails… I
feel like I am missing something?
For me, I know it does take space but just to be meticulous I do install rails anew for each project (I do use the --no-rdoc --no-ri options and it really does not take so long). That said I am also generally taking the newest release version.
So you do end up with a chicken and egg problem, so what I do is the following sequence - first create the gemset, install rails, then create the app:
rvm gemset create my_new_app
rem 1.9.2-p136@my_new_app
gem install rails
rails my_new_app
cd my_new_app
…