RVM for each project

I find it difficult to understand RVM for each project. I installed RVM and 1.9.2 and 1.8.7 rubies, according to http://beginrescueend.com/interpreters/ruby/ , and when I want to start a new project, I was

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

But it takes a lot of time! (rail mounting). Then I rails new test1; cd test1 rails new test1; cd test1

I am really not sure about the correct workflow. If I create a new application for testing, I do not want to wait until the rails are installed.

It seems from http://beginrescueend.com/gemsets/basics/ that I can create gemset rails, but how can I create gemset for each project?

Edit:

If I am going to use several versions of ruby ​​/ rails, 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 later, create a blah gemset ?

+4
source share
2 answers

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

Big idea: creating a gemset for each project allows you to change gems (and gem versions) for one project without breaking all your other projects. Each project should only worry about its gems. This is a good idea, and the wait time for installing large gems such as Rails is usually worth it.

However, if you intend to use the same version of Rails for all your projects and want to save time, you can set the rails (and possibly the rake as well) in the 'global' gemset - these gems are available in all gemset for this ruby ​​version .

Assuming you already have a test1 gemset:

 $ rvm gemset use global $ gem install rails $ gem install rake $ rvm gemset use test1 $ rails test1 
+10
source

Once I wrote a simple blog on how to use RVM with gem sets , this may be useful for you.

UPDATE: since the link above is dead, I believe that it is located elsewhere here .

+1
source

Source: https://habr.com/ru/post/1386989/


All Articles