简体   繁体   English

捆绑包是否在全球范围内安装gem

[英]Does bundle package install gems globally

I used to have a new ruby installation for each new rails project, because it's impossible not to have conflicting gems with between two of them. 我曾经为每个新的rails项目安装了一个新的ruby安装程序,因为不可能在其中两个之间没有冲突的宝石。

I have seen that 'bundle package' command could freeze a project specific set of gems in the 'vendr/cache' directory. 我已经看到“捆绑包”命令可以冻结“ vendr / cache”目录中特定于项目的一组宝石。

I though it wouldn't install them globally, just store them in that directory. 我虽然不会在全球范围内安装它们,只需将它们存储在该目录中即可。

However, when i did it, 'bundle package' ended up installing (globally) the gems before storing them in 'vendor/cache' folder. 但是,当我这样做时,“捆绑包”最终(在全球范围内)安装了gem,然后将它们存储在“ vendor / cache”文件夹中。

Did I do something wrong? 我做错什么了吗? Is it a bug? 是虫子吗?

From the Bundler docs : Bundler文档

The package command will copy the .gem files for your gems in the bundle into ./vendor/cache . package命令会将捆绑包中的宝石的.gem文件复制到./vendor/cache

As far as I can tell, Bundler does not handle installing gems, it passes that off to the gem command. 据我所知,Bundler不处理安装gem,而是将其传递给gem命令。 What Bundler does is to make sure that you have the right version of the gem activated. Bundler要做的是确保您激活了正确版本的宝石。 So even when you package the gems, when you later install them it'll take those gems and install them "globally". 因此,即使打包了这些宝石,以后再安装它们时,它们也将带走这些宝石并“全局”安装它们。

So, to answer your question: No, you didn't do anything wrong and this is not a bug but the intended behaviour. 因此,回答您的问题:不,您没有做错任何事情,这不是bug,而是预期的行为。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM