如何使用 RVM 管理多个 gemset 和 ruby​​ 版本? [英] How to manage multiple gemsets and ruby versions with RVM?

查看:27
本文介绍了如何使用 RVM 管理多个 gemset 和 ruby​​ 版本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对 RVM 网站中给出的解释感到非常困惑.我不清楚不同的 ruby​​ 解释器和 gemset 之间的关系.在我看来,是这样的——

I am really confused by the explanations given in RVM website. The relation between different ruby interpretors and gemsets are not clear to me. According to me, it is like this -

  1. 我的 Mac 帐户有一个 rvm
  2. rvm 安装和管理一组不同版本的 ruby​​ 解释器.
  3. 每个 ruby​​ 版本都有一组 gemset.

我说清楚了吗?欢迎提供更多解释.我可以处理(Ruby 1.8.7 + rails 2.3.8 及其依赖项)和(Ruby 1.9.2 和 Rails 3.0 及其依赖项)...

Am i getting things clear... Any more amount of explanations are welcome. I am in a position to work on (Ruby 1.8.7 + rails 2.3.8 and its dependencies) and (Ruby 1.9.2 and Rails 3.0 and its dependencies)...

如果有人精通在 rvm 的帮助下处理许多 ruby​​ 版本和 gemset,请向我解释...感谢您的帮助

If any one is well versed with handling many ruby versions and gemsets with the help of rvm, please explain to me... thanks for the help

推荐答案

我喜欢这样做...

  1. 使用 RVM 安装 ruby​​
  2. 切换到/使用该红宝石
  3. 为项目创建 gemset
  4. 切换到/使用该 gemset
  5. 需要安装 gems
  6. 创建一个指向我选择的 ruby​​ 的别名 &宝石
  7. 切换到/使用该新别名(同样,与项目相关联)

为您希望彼此分开的不同项目多次执行此操作.

Do this as many times necessary for your different projects that you want to keep separate from eachother.

示例:

$ rvm install ruby-1.9.2
...
$ rvm list

rvm rubies

=> ree-1.8.7-head [ i386 ]
   ruby-1.9.2-head [ i386 ]
   ruby-1.9.2-preview3 [ i386 ]

$ rvm use ruby-1.9.2-preview3

info: Using ruby 1.9.2 preview3
$  rvm gemset create my_project

info: Gemset 'my_project' created.
rvm gemset use my_project

info: Now using gemset 'my_project'
$ gem install httparty
When you HTTParty, you must party hard!
Successfully installed crack-0.1.8
Successfully installed httparty-0.6.1
2 gems installed
$ rvm alias create my_project ruby-1.9.2-preview3@my_project

info: Creating alias my_project for ruby-1.9.2-preview3@my_project.

info: Recording alias my_project for ruby-1.9.2-preview3@my_project.
$ rvm use my_project

info: Using ruby 1.9.2 preview3 with gemset my_project
$ ....

现在我有一个专门用于特定项目的完整环境.这很棒,因为我可以尝试各种不同的 gem/版本,而不必担心会踩到其他有非常特殊要求的项目.

Now I have an entire environment dedicated to a particular project. This is great because I can experiment with all sorts of different gems/versions without worrying about stomping all over other projects that have very specific requirements.

祝你好运!

这篇关于如何使用 RVM 管理多个 gemset 和 ruby​​ 版本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆