简体   繁体   English

是否可以使用rvm和bundler来缓存gem?

[英]Is it possible to cache gems using rvm and bundler?

We have many gems in several rails projects. 在几个Rails项目中,我们有很多宝石。 We use rvm and bundler and rubygems and gemsets. 我们使用rvm和bundler以及rubygems和gemsets。 Is there a way to locally cache the gems that I need instead of having bundler ask gem to go get them? 有没有一种方法可以本地缓存我需要的宝石,而不是让捆绑器要求宝石去获得它们? We change the gem name each time we have a new major branch... My system has many copies of many of the gems I am downloading. 每当我们有新的主要分支时,我们都会更改gem的名称。我的系统有许多我正在下载的gem的副本。 I have tried using a proxy, but that does not seem any faster, and requires running the vm and sometimes I have to manually flush the cache because it gets mixed up about what is available. 我尝试使用代理,但这似乎没有更快,并且需要运行vm,有时我必须手动刷新缓存,因为它混淆了可用的内容。

You can use bundle install --path vendor/bundle in development mode to set your gems in vendor folder, and bundle package to grab the gems and packages them in vendor/cache. 您可以在开发模式下使用bundle install --path vendor/bundle在供应商文件夹中设置gem,并使用bundle package来获取gem并将它们打包在vendor / cache中。 Read more about bundle package . 阅读有关捆绑包的更多信息。

Read this question, and answers , I hope it'll be helpful for you. 阅读此问题和答案 ,希望对您有所帮助。

Bundler does not currently use a shared, local cache, but you might have better luck by not using gemsets. Bundler当前不使用共享的本地缓存,但是使用gemset可能会带来更好的运气。

By default, Bundler installs gems to a shared location, and if you use the same shared location for all of your projects, it will reuse the same installed gems for any projects that use the same version of those gems (assuming that they use the same version of Ruby, too). 默认情况下,Bundler将gem安装到共享位置,并且如果您对所有项目使用相同的共享位置,则它将对使用相同版本的gem的所有项目重复使用已安装的gem(假设它们使用相同的gem) Ruby版本)。

The isolation provided by gemsets is largely unnecessary with Bundler, which sets up load paths correctly so that only the correct version of each gem is visible to the application. Bundler在很大程度上不需要由gemsets提供的隔离,Bundler可以正确设置加载路径,因此应用程序只能看到每个gem的正确版本。

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

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