2015-02-10 49 views

回答

2

一种方法是使用Gemfile并在其中设置ruby版本。像这样:

ruby '2.2.0' 

那么当你进入该目录,你会看到从rvm

RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too, 
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/danmanstx/rails_projects/app/Gemfile'. 
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'. 
1

下面的消息你的版本信息创建一个.ruby-version文件在该目录中。要将目录的版本设置为2.1.2,请仅使用“2.1.2”作为内容创建文件。

$ duggout [master] ⚡ cat .ruby-version 
2.1.2 
3
RVM documentation

直接:

RVM支持多种文件允许配置自动开关红宝石项目。无论如何,确保将这些文件添加到版本控制系统,因为它是项目配置的一部分。

列入优先顺序:

  • .rvmrc - shell脚本允许环境的完全自定义,
  • .versions.conf - key = value的配置文件
  • .ruby版本 - 单线红宝石版本只
  • 的Gemfile” - 评论:#红宝石= 1.9.3和指令:红宝石 “1.9.3”
+0

这是迄今为止发布的最完整的答案。 – 2015-02-10 14:59:07

+0

我也注意到虽然它是列表中的第三个,但我认为'.ruby-version'是最普遍的首选方法,除非您特别需要其他特性之一的特性。 – DGM 2015-02-10 15:08:47

0

或者只需使用rvm --ruby-version [email protected] --create,--create here将创建gemset,如果它不存在。如果您不需要指定gemset,而是使用默认的gemset。请留下@gemset --create。例如,。