[英]RVM switching to @global gemset instead of a specific one
When I enter my rails dir on server RVM switch to 当我在服务器RVM上输入我的rails目录时,切换到
/home/capistrano/.rvm/gems/ruby-1.9.2-p290@global/bin/bundle
although it should use ruby-1.9.2-p290@mygemset/bin/bundle
as it works on my local machine. 尽管应该在我的本地计算机上使用ruby-1.9.2-p290@mygemset/bin/bundle
。 When I type rvm use 1.9.2@mygemset
it works. 当我输入rvm use 1.9.2@mygemset
。 Nginx server is also looking for gems in the @global gemset Nginx服务器也在@global gemset中寻找宝石
my .rvmrc
file: 我的.rvmrc
文件:
environment_id="ruby-1.9.2-p290@mygemset"
if [[ -d "${rvm_path:-$HOME/.rvm}/environments" \
&& -s "${rvm_path:-$HOME/.rvm}/environments/$environment_id" ]]
then
\. "${rvm_path:-$HOME/.rvm}/environments/$environment_id"
if [[ -s "${rvm_path:-$HOME/.rvm}/hooks/after_use" ]]
then
. "${rvm_path:-$HOME/.rvm}/hooks/after_use"
fi
else
# If the environment file has not yet been created, use the RVM CLI to select.
if ! rvm --create use "$environment_id"
then
echo "Failed to create RVM environment '${environment_id}'."
return 1
fi
fi
RVM is going through rapid develpment so the syntax and functionality of commands sometimes vary. RVM正在快速发展,因此命令的语法和功能有时会有所不同。 Anyway, I solved it with upgrading to stable RVM: 无论如何,我通过升级到稳定的RVM解决了它:
rvm get stable
which is now rvm 1.14.1 (stable)
. 现在是rvm 1.14.1 (stable)
。 Afterwards commands like rvm 1.9.3-p194@mygemset --create
works perfectly. 之后,像rvm 1.9.3-p194@mygemset --create
这样的命令可以完美地工作。
Another thing I was missing is the new syntax for executing commands: 我缺少的另一件事是执行命令的新语法:
rvm @mygemset do bundle install
This will install all gems for given gemset and ruby specified in .rvmrc file 这将为.rvmrc文件中指定的给定宝石集和红宝石安装所有宝石。
I'm not sure if I understood you but you could place an .rvmc
file in your rails folder and put something like this in it. 我不确定我是否了解您,但是您可以将.rvmc
文件放在rails文件夹中,并在其中放入类似内容。
rvm use ruby-1.9.2@mygemset
Whenever you cd into that directory rvm will use settings from the .rvmc
file. 每当您CD进入该目录时,rvm都将使用.rvmc
文件中的设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.