rvm如何管理Gem/gemsets
我想知道 RVM 如何管理宝石/宝石集。例如,我默认使用 ruby 1.9.2@global 并在此环境中安装了 Rails 3.1.3。后来我从别人那里复制了一个rails项目,它是基于rails 3.0.10的。通过 cd 进入该文件夹,我运行了rails -v,它建议我运行捆绑安装。我就这么做了。之后,安装了很多 gem,包括 Rails 3.0.10。但是当我执行 rvm 1.9.2 do gemset list 时,没有新的 gemset(尽管这是预期的)。那么如何管理两个版本的rails呢?
先感谢您
I am wondering how RVM manages the gem/gemsets. For instance, I have by default been using ruby 1.9.2@global and installed rails 3.1.3 in this environment. Later I copied a rails project from other, which is based on rails 3.0.10. By cd into the folder, I ran rails -v, it recommended me to run bundle install. I did so. After this, lots of gems were installed including rails 3.0.10. But when I do rvm 1.9.2 do gemset list, there is no new gemset( this is expected though). Then how do I manage the two versions of rails?
Thank you in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的
Gem.path
中可以有多个路径。尝试运行 ruby -r rubygems -e "p Gem.path" 并检查输出,您将看到
@global
和您当前的 gemset 都包含在内。Rubygems 使用 $GEM_PATH 变量来确定在哪里查找/安装 gem,这是 RVM 在更改 ruby 版本/gemset 时设置的内容之一。
此外,可能值得查看一些 RVM 设置的环境变量。运行这个:
可能会有一些额外的变量(包括
$PATH
),但是您通常会看到很多 RVM 环境变量。这就是为什么有些人喜欢 rbenv,这是一种管理 ruby 版本的更简单方法。
You can have more than one path into your
Gem.path
.Try running
ruby -r rubygems -e "p Gem.path"
and check the output, you'll see that both@global
and your current gemset are included.Rubygems use the
$GEM_PATH
variable to figure out where to look/install gems, and that's one of the things RVM sets when you change a ruby version/gemset.Also, it might be worth to look at a few environment variables RVM sets. Run this:
There might be a few extra ones (including
$PATH
), but you'll general you'll see a lot of RVM environment variables.That's why some people like rbenv, a simpler way to manage ruby versions.