1
votes

My Rails 3.2 / Ruby 1.9.3 app is using RVM. I want to upgrade to using ruby 2.1.5.

I have used RVM to install Ruby 2.1.5 as well. So rvm list shows both 1.9.3 and 2.1.5

My project directory has a .rvmrc file specifying

environment_id="ruby-1.9.3-p551@current_foogems"

So I have a gemset named current_foogems

How can I switch my project to use ruby 2.1.5?

Do I copy the gemset? Create a new (empty) gemset?

Given the jump in ruby version from 1.9.3 to 2.1.5, which may mean I should recompile gems, I'm thinking the safe approach might be:

i) create a new blank gemset 'new_foogems'
ii) edit the .rvmrc file to use "ruby-2.1.5@new_foogems"
iii) run bundle install to re-create all-new gems in the new gemset
1
that's the whole purpose of gemsets, so you can separate ruby and/or rails versions with your projects, you can just run rvm 2.1.3@new_foogems AFTER creating the new gemset, you will also have to change you ruby version on your Gemfile and be careful for potential bugs, don't forget to do the change on development not on production!!!Santiago Suárez
you can use something like rvm use 2.1.5@current_foogems --create and then set it to current gemset using rvm use 2.1.5@current_foogems and then bundle install in that gemsetMilind

1 Answers

0
votes

Per comments from @Santiago and @Milind, the answer is to

1) edit the .rvmrc file and give environment_id a new value such as'= ruby-2.1.5@new_foogems and also edit the Gemfile to specify ruby "2.1.5"

2) leave directory (cd ..)

3) go back into directory (to reload the .rvmrc)

4) says "yes" to alert the .rvmrc file changed

RVM will create the new blank gemset.

5) Run rvm install 2.1.5

6) run bundle install