【发布时间】:2011-05-11 02:35:22
【问题描述】:
我使用 EngineYard,但我的部署失败了。我收到这条消息:
Some gems seem to be missing from your vendor/cache directory.
Could not find rspec-core-2.6.0.rc2 in any of the sources
如何确保这些 gem 进入该目录?
【问题讨论】:
我使用 EngineYard,但我的部署失败了。我收到这条消息:
Some gems seem to be missing from your vendor/cache directory.
Could not find rspec-core-2.6.0.rc2 in any of the sources
如何确保这些 gem 进入该目录?
【问题讨论】:
Bundler 提供了一个显式创建此缓存的命令
bundle package
在您完成此捆绑安装后,将检查并保持供应商/缓存目录是最新的。
如果您想在机器上安装 gem 而不检查 rubygems,您只需运行
bundle install --local
但是,请注意,如果您经常升级 gem(就像我每次发布 Rails 的子版本一样),您的供应商/缓存可能会快速增长。
我目前项目的git仓库是80mb,其中超过30mb是存放在vendor/cache中的数据。
加快部署似乎是个好主意, 但总的来说,它只是让我们的存储库变得更大。
【讨论】:
如果其他人在使用 Capistrano 部署时遇到这种情况,这为我解决了这个问题: https://github.com/carlhuda/bundler/issues/1454
在我的情况下,有一个空的供应商/缓存目录导致了问题。
解决方案是从版本控制和提交 + 部署中删除(不仅仅是忽略内容!)vendor/cache 目录。
【讨论】:
捆绑包而不安装下载的gem。
bundle package --no-install
【讨论】:
我想通了。我刚刚输入:
bundle
在命令行中,它添加了缺少的宝石。
【讨论】:
bundle 等价于bundle install,它本身并不将gem 放入供应商/缓存中。你需要使用bundle package