How can I add gems to my vendor/cache directory in a Rails 3 app?
I use EngineYard, and I have a deployment that is failing. I am getting this message:
Some gems seem to be missing from your vendor/cache directory.
Could not find rspec-co开发者_JS百科re-2.6.0.rc2 in any of the sources
How do I make sure those gems get in that directory?
Bundler ships a command which explicitly creates this cache
bundle package
After you've done this bundle install will check and keep the vendor/cache directory up to date.
If you then want to install the gems on a machine without checking on rubygems, you just run
bundle install --local
However, beware, if you are upgrading gems frequently (like I do every time a subrelease of Rails comes out), your vendor/cache can quickly grow.
My current project's git repository is 80mb, of which more than 30mb is data stored in vendor/cache.
It seemed like a good idea to speed up deploys, but overall its just made our repository much bigger.
In case anyone else is experiencing this when deploying with Capistrano, this solved it for me: https://github.com/carlhuda/bundler/issues/1454
Having an empty vendor/cache directory was causing the problem in my case.
Solution was to delete (not just ignore the contents of!) the vendor/cache directory from version control and commit + deploy.
Its bundle cache
now for anyone wondering
bundle cache(1) bundle-cache.1.html Package the .gem files required by your application into the vendor/cache directory (aliases: bundle package, bundle pack)
bundle package without installing the downloading gems.
bundle package --no-install
I figured this out. I just typed:
bundle
at the command line, and it added the missing gems.
精彩评论