Search code examples
ruby-on-rails-3bundler

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-core-2.6.0.rc2 in any of the sources

How do I make sure those gems get in that directory?


Solution

  • 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.