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

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

问题描述

我很困惑于RVM网站给出的解释。不同的ruby解释器和gemsets之间的关系我不清楚。根据我的说法,这是这样的 -


  1. 我的Mac中的帐户有一个rvm

  2. 该rvm安装并管理不同版本的ruby解释器。
  3. 每个ruby版本都有一组gemset。

我是否清楚明白...欢迎任何更多的解释。我有能力开发(Ruby 1.8.7 + rails 2.3.8及其依赖项)和(Ruby 1.9.2和Rails 3.0及其依赖项)...

如果任何一个人熟悉在rvm的帮助下处理许多ruby版本和gemset,请向我解释...感谢您的帮助

解决


  1. 使用RVM安装ruby
  2. 使用RVM安装ruby
  3. 切换到/使用那个ruby

  4. 为项目创建一个gemset

  5. 切换到/使用那个gemset
  6. >
  7. 安装所需的宝石

  8. 创建一个别名,指向我选择的ruby& gemset

  9. 切换到/使用该新别名(再次与项目关联)

尽可能多地为不同的项目所需要的时间,以便与其他项目保持分开。



示例:

  $ 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:使用ruby 1.9.2 preview3
$ rvm gemset create my_project

info:创建Gemset'my_project'。
rvm gemset使用my_project

info:现在使用gemset'my_project'
$ gem install httparty
当你使用HTTParty时,你必须努力工作!
成功安装crack-0.1.8
成功安装httparty-0.6.1
安装了gem
$ rvm别名create my_project ruby​​-1.9.2-preview3@my_project

info:为ruby-1.9.2-preview3@my_project创建别名my_project。

info:为ruby-1.9.2-preview3@my_project录制别名my_project。
$ rvm使用my_project

info:使用ruby 1.9.2 preview3和gemset my_project
$ ....

现在我有一个专用于特定项目的整个环境。这非常棒,因为我可以尝试各种不同的宝石/版本,而不用担心其他项目会有很严格的要求。



祝您好运!


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. My Account in my Mac have one rvm
  2. That rvm installs and manages set of different versions of ruby interpretors.
  3. each ruby version has set of gemsets.

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)...

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

解决方案

Here is how I like to do it...

  1. Install a ruby with RVM
  2. Switch to/use that ruby
  3. Create a gemset for a project
  4. Switch to/use that gemset
  5. Install gems needed
  6. create an alias that points to my chosen ruby & gemset
  7. switch to/use that new alias (again, associated w/ a project)

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

Example:

$ 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
$ ....

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.

Good luck!

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

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