问题描述
对于我的不同 Rails 文件夹,我希望 rvm 在运行从捆绑安装"到执行自动测试"或 Rails 控制台或服务器的任何操作时自动加载正确的 gemset.这可能吗?目前我必须手动执行rvm 使用",因为我同时处理多个 Rails 项目,这有点乏味.
For my different Rails folders, I would like to have rvm automatically load the correct gemset when running anything from 'bundle install' to doing my 'autotest' or rails console or server. Is this possible? Currently I have to manually do 'rvm use' which is getting a bit tedious as I am working on multiple Rails projects at the same time.
推荐答案
在你的 rails 目录中创建一个 .rvmrc
文件,rvm 会自动加载它.加载 Ruby 1.9.2 和名为rails3"的 gemset 的示例 .rvmrc
:
Create a .rvmrc
file in your rails directory, and rvm will automatically load it. An example .rvmrc
that loads Ruby 1.9.2 and a gemset named "rails3":
.rvmrc
rvm 1.9.2@rails3
您还可以做更多的事情,这里有详细描述:https://rvm.io/workflow/rvmrc/
You can do a lot more too, described in detail here: https://rvm.io/workflow/rvmrc/
这篇关于切换到 Rails 文件夹时,让 rvm 选择 ruby 和 gemset?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!