简体   繁体   English

如何使用RVM将Rails 3.2应用程序从ruby 1.9.3升级到ruby 2.1.5

[英]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.

相关问题 如何不使用rvm将Rails 4.1应用程序从ruby 1.9.3升级到ruby 2.1.5 - How do I upgrade a rails 4.1 app from ruby 1.9.3 to ruby 2.1.5 without using rvm 如何使用RVM在Rails应用程序上升级Ruby的Ruby版本 - How to upgrade ruby version of ruby on rails app using rvm 如何在没有 RVM 的情况下在 Ubuntu 上安装 Ruby 1.9.3? - How do I install Ruby 1.9.3 on Ubuntu without RVM? 使用RVM或Brightbox Gem升级到红宝石1.9.3 - Upgrade to ruby 1.9.3 with rvm or brightbox gems 使用rvm升级到ruby 1.9.3会破坏我的rails应用程序 - upgrading to ruby 1.9.3 with rvm breaks my rails app 如何在不使用RVM的情况下指定Ruby for Rails的版本? - How do I specify a version of Ruby for Rails without using RVM? 如何使用 Ruby 1.9.3、passenger、nginx 和 rvm 安装 rails 3.2.2? - How to install rails 3.2.2 with Ruby 1.9.3, passenger, nginx and rvm? 如何从Rails 2.3.8应用程序的Ruby 1.8.7升级到Ruby 1.9.2? - How do I upgrade from Ruby 1.8.7 to Ruby 1.9.2 for Rails 2.3.8 app? 我如何使Ruby 1.9.3应用适应在使用Ruby 1.8.7的服务器上工作 - How do I adapt a Ruby 1.9.3 app to work on a Server using Ruby 1.8.7 使用RVM在ruby 2.2.0上安装rails 4.2生成“你的Ruby版本是2.2.0,但你的Gemfile指定为2.1.5” - installing rails 4.2 on ruby 2.2.0 using RVM generates “Your Ruby version is 2.2.0, but your Gemfile specified 2.1.5”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM