Rubygems,Bundler和RVM之间的关系 [英] Relationships between Rubygems, Bundler, and RVM

查看:251
本文介绍了Rubygems,Bundler和RVM之间的关系的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

按照目前的最佳做法,每种方法的适当角色是什么?基于对Bundler和RVM的有限理解,似乎它们 - 像Rubygems - 拥有自己的宝石安装位置。另外,对于每一个,都可以选择使用 sudo 安装到系统路径或安装到您的主目录。然后有能力向Bundler供应宝石(在适用的情况下,例如使用Rails)。



因此,我认为现在至少有七个地方可以安装gems :


  • Rubygems系统路径

  • Rubygems用户路径

  • RVM系统路径

  • RVM用户路径

  • Bundler系统路径
  • Bundler用户路径

  • 供应商(每应用程序)



那么管理所有这些的最佳方法是什么?我们是否全部使用三种(Rubygems,Bundler,RVM)并告诉他们所有人都将宝石安装到同一个地方?我们是否一直在使用 sudo ,有时甚至是永远不会使用?我们应该在生产和开发机器上使用不同的策略吗?

在相关说明中,Bundge和RVM是否包装Rubygems,它们是替代它还是他们完全正交吗?

解决方案

从Bundler的网站


Bundler可以轻松确保您的应用程序具有启动和运行所需的依赖关系没有错误。

这意味着对于其他开发人员或者您在另一台机器上准备进一步开发或使用它通过运行 bundle install 来获得并运行所需的一切。



RVM用于管理同一台机器上的多个Ruby版本,并在它们之间切换。 Gemsets是一个强大的功能,RVM提供了从系统其余部分中隔离一个应用程序/库的宝石。



当RVM和Bundler一起使用时,RVM告诉Bundler哪里有宝石Bundle将它们安装到RVM文件夹中。



两者(关于RVMs中的gem)都使用并依赖于Rubygems,所以它们最接近包装。



我个人使用Bundler和RVM来处理我的所有项目。没有宝石套装,只有Bundler能够解决和修复问题,而不会失败。安装gems时没有 sudo ,并且在RVM定义的地方结束。我的系统上的默认Ruby安装是独立的,没有任何安装到Rubygems系统/用户路径


Following current best practices, what is the proper role for each of these?

Based on my limited understanding of Bundler and RVM, it seems that they--like Rubygems--have their own install locations for gems. Plus, for each one, there's the option of installing to system paths using sudo or to your home directory. And then there's the ability to vendor gems with Bundler (where applicable, e.g. with Rails).

So it looks to me like there are at least seven places to install gems now:

  • Rubygems system path
  • Rubygems user path
  • RVM system path
  • RVM user path
  • Bundler system path
  • Bundler user path
  • Vendor (per-app)

So, what's the best way to manage all this? Do we use all three (Rubygems, Bundler, RVM) and tell them all to install gems to the same place? Do we use sudo all the time, some of the time, or never? And should we be using a different strategy on production and development machines?

On a related note, are Bundler and RVM wrappers around Rubygems, are they alternatives to it, or are they completely orthogonal to it?

解决方案

From Bundler's website:

Bundler makes it easy to make sure that your application has the dependencies it needs to start up and run without errors.

This means that it's trivial for some other developer, or you on another machine, to get ready to develop further or use it, by running bundle install and you have everything you need to get up and running.

RVM is for managing multiple versions of Ruby on the same machine, and switching between them. Gemsets is a powerful feature RVM provides that isolates gems for one application/library from the rest of your system.

When using RVM and Bundler together, RVM tells Bundler where the gems should go, and Bundler installs them into the RVM-folder.

Both (with regards to gems in RVMs case) use and depend on Rubygems, so they're closest to wrappers.

I, personally, use Bundler and RVM for all my projects. No gemsets, just Bundler to resolve and fix things, which it does without fail. Installing gems is done without sudo, and ends up in the place RVM defines. The default Ruby install on my system is left alone, and nothing is installed to Rubygems system/user path

这篇关于Rubygems,Bundler和RVM之间的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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