I need to specify a ruby version in my Gemfile for Heroku:
我需要在我的Gemfile中为Heroku指定一个ruby版本:
ruby '2.1.1'
That works as expected. However, it messes with my local terminal as well. I try to set the default ruby version and gemset in RVM with:
像预期的那样工作。但是,它也会影响到我的本地终端。我尝试将RVM中的默认ruby版本和gemset设置为:
$ rvm --default use ruby-2.1.1@rails4
Using /Users/scott/.rvm/gems/ruby-2.1.1 with gemset rails4
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/scott/.rvm/gems/ruby-2.1.1)
(default)
global
=> rails4
Seems fine and it works as expected. However, if I open up another terminal shell I get this:
看起来很好,而且运行正常。但是,如果我打开另一个终端外壳,我会得到:
Last login: Fri Mar 14 16:54:23 on ttys009
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/scott/code/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
$ rvm gemset list
gemsets for ruby-2.1.1 (found in /Users/scott/.rvm/gems/ruby-2.1.1)
=> (default)
global
rails4
I want it to use the rails4
gemset always! How can I do this?
我想让它永远使用rails4 gemset !我该怎么做呢?
1 个解决方案
#1
3
Only way you could do it is to add two files to your application: .ruby-version
and .ruby-gemset
and add 2.1.1
in the .ruby-version
file and rails4
in the .ruby-gemset
file.
惟一的方法是向应用程序添加两个文件:.ruby版本和.ruby-gemset,并在.ruby版本文件中添加2.1.1,在.ruby-gemset文件中添加rails4。
You can also do this on your command line with:
您也可以在命令行中这样做:
echo 2.1.1 > .ruby-version
and
和
echo rails4 > .ruby-gemset
And that will create the files for you with the version 2.1.1 and the gemset rails4
这将为您创建版本2.1.1和gemset rails4的文件。
So whenever you open a new terminal, rvm will use ruby 2.1.1 and gemset rails 4
因此,每当您打开一个新的终端时,rvm都会使用ruby 2.1.1和gemset rails 4
Check out more on rvm documentation
查看更多关于rvm文档的信息
Hope this helps
希望这有助于
#1
3
Only way you could do it is to add two files to your application: .ruby-version
and .ruby-gemset
and add 2.1.1
in the .ruby-version
file and rails4
in the .ruby-gemset
file.
惟一的方法是向应用程序添加两个文件:.ruby版本和.ruby-gemset,并在.ruby版本文件中添加2.1.1,在.ruby-gemset文件中添加rails4。
You can also do this on your command line with:
您也可以在命令行中这样做:
echo 2.1.1 > .ruby-version
and
和
echo rails4 > .ruby-gemset
And that will create the files for you with the version 2.1.1 and the gemset rails4
这将为您创建版本2.1.1和gemset rails4的文件。
So whenever you open a new terminal, rvm will use ruby 2.1.1 and gemset rails 4
因此,每当您打开一个新的终端时,rvm都会使用ruby 2.1.1和gemset rails 4
Check out more on rvm documentation
查看更多关于rvm文档的信息
Hope this helps
希望这有助于