2015-02-10 378 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。例如,。