[英]How do I upgrade a rails 3.2 app from ruby 1.9.3 to ruby 2.1.5 using rvm
My Rails 3.2 / Ruby 1.9.3 app is using RVM. My Rails 3.2 / Ruby 1.9.3应用程序正在使用RVM。 I want to upgrade to using ruby 2.1.5.
我想升级到使用ruby 2.1.5。
I have used RVM to install Ruby 2.1.5 as well. 我也使用RVM来安装Ruby 2.1.5。 So
rvm list
shows both 1.9.3 and 2.1.5 因此
rvm list
显示1.9.3和2.1.5
My project directory has a .rvmrc file specifying 我的项目目录中有一个.rvmrc文件,指定
environment_id="ruby-1.9.3-p551@current_foogems"
environment_id = “ruby-1.9.3-p551@current_foogems”
So I have a gemset named current_foogems 所以我有一个名为current_foogems的宝石集
How can I switch my project to use ruby 2.1.5? 如何切换项目以使用ruby 2.1.5?
Do I copy the gemset? 我要复制宝石吗? Create a new (empty) gemset?
创建一个新的(空)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: 鉴于红宝石版本从1.9.3跃升至2.1.5,这可能意味着我应该重新编译gem,我认为安全的方法可能是:
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
Per comments from @Santiago and @Milind, the answer is to 根据@Santiago和@Milind的评论,答案是
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"
1)编辑.rvmrc文件,并给environment_id一个新值,例如'=
ruby-2.1.5@new_foogems
,还编辑Gemfile以指定ruby "2.1.5"
2) leave directory (cd ..) 2)离开目录(cd ..)
3) go back into directory (to reload the .rvmrc) 3)返回目录(重新加载.rvmrc)
4) says "yes" to alert the .rvmrc file changed 4)说“是”以警告.rvmrc文件已更改
RVM will create the new blank gemset. RVM将创建新的空白gemset。
5) Run rvm install 2.1.5
5)运行
rvm install 2.1.5
6) run bundle install
6)运行
bundle install
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.