How do I upgrade a rails 3.2 app from ruby 1.9.3 to ruby 2.1.5 using rvm

血红的双手。 提交于 2019-12-24 10:30:13

问题


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:


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



来源:https://stackoverflow.com/questions/29505339/how-do-i-upgrade-a-rails-3-2-app-from-ruby-1-9-3-to-ruby-2-1-5-using-rvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!