问题描述
My Rails 3.2/Ruby 1.9.3应用程序正在使用RVM.我想升级到使用ruby 2.1.5.
My Rails 3.2 / Ruby 1.9.3 app is using RVM. I want to upgrade to using ruby 2.1.5.
我也使用RVM来安装Ruby 2.1.5.因此rvm list
同时显示1.9.3和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
我的项目目录中有一个指定的.rvmrc文件
My project directory has a .rvmrc file specifying
所以我有一个名为current_foogems的宝石集
So I have a gemset named current_foogems
如何切换项目以使用ruby 2.1.5?
How can I switch my project to use ruby 2.1.5?
我可以复制宝石吗?创建一个新的(空的)宝石集?
Do I copy the gemset? Create a new (empty) gemset?
鉴于红宝石版本从1.9.3跃升至2.1.5,这可能意味着我应该重新编译gem,我认为安全的方法可能是:
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
推荐答案
根据@Santiago和@Milind的评论,答案是
Per comments from @Santiago and @Milind, the answer is to
1)编辑.rvmrc文件,并给environment_id一个新值,例如'= ruby-2.1.5@new_foogems
,还编辑Gemfile以指定ruby "2.1.5"
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)离开目录(cd ..)
2) leave directory (cd ..)
3)返回目录(以重新加载.rvmrc)
3) go back into directory (to reload the .rvmrc)
4)说是"以提醒.rvmrc文件已更改
4) says "yes" to alert the .rvmrc file changed
RVM将创建新的空白gemset.
RVM will create the new blank gemset.
5)运行rvm install 2.1.5
6)运行bundle install
这篇关于如何使用RVM将Rails 3.2应用程序从ruby 1.9.3升级到ruby 2.1.5的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!