这是一个简单的问题,但我似乎在文档中找不到一个好的答案(我是RVM的新手)。
rvm使用ruby-1.9.2-head@rails3和rvm ruby-1.9.2-head@rails3有什么区别?
我尝试为2个项目设置两个版本的gemsets (rails 3.1和3.0.9),并打算这样做:
rvm gemset create proj1 proj2
rvm 1.9.2-head@proj1
gem install rails -v 3.1
rvm 1.9.2-head@proj2
gem install rails -v 3.0.9然后试着弄清楚是否应该使用
rvm 1.9.2-head@proj1 或
rvm use 1.9.2-head@proj1切换到该项目/gemset。因此我的问题..。
发布于 2011-09-13 01:28:29
AFAIK中,rvm命令本身就是用来在ruby/ruby gem的多个版本上运行一些东西的。例如,您可以指定rvm 1.9.2,1.8.7 test.rb,它将使用这两个红宝石执行test.rb。
相反,rvm use将您当前的shell环境设置为使用您传递的任何ruby。所以如果你使用rvm use 1.9.2@proj1,你的下一个ruby命令可以简单地是ruby whatever.rb,并且rvm将使用你的proj1 gem设置选择ruby1.9.2。
所以,总而言之,当你想在多个ruby上运行时,使用rvm 1.9.2,1.8.7 something.rb,当你想设置当前shell将使用的ruby时,使用rvm use 1.9.2。
编辑
这会在评论中看起来很糟糕,所以我改而编辑。这些rvm命令的输出如下所示:
## RVM use will set the ruby for this shell
[Moe:~]$ rvm use 1.9.2
Using /Users/nunya/.rvm/gems/ruby-1.9.2-p290
[Moe:~]$ ruby -e 'puts `rvm current`'
ruby-1.9.2-p290
## rvm without the use will execute the command with all the rubies passed,
## but will leave the shells ruby alone.
[Moe:~]$ rvm 1.9.2,1.9.3 -e 'puts `rvm current`'
ruby-1.9.2-p290
ruby-1.9.3-preview1
[Moe:~]$ ruby -e 'puts `rvm current`'
ruby-1.9.2-p290
# with a single ruby:
[Moe:~]$ rvm 1.9.3 -e 'puts `rvm current`'
ruby-1.9.3-preview1
[Moe:~]$ rvm current
ruby-1.9.2-p290发布于 2011-09-14 00:40:10
两者之间的区别
rvm use 1.9.2而且简单明了
rvm 1.9.2简单地说就是RVM是否会显示从一个ruby|ruby@gemset到另一个ruby|ruby@gemset的更改信息。关键字'use‘只会导致RVM显示更改后的设置。
https://stackoverflow.com/questions/7391534
复制相似问题