Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 390
AKWF Avatar asked May 11 '11 02:05

AKWF


2 Answers

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.

like image 70
Matthew Rudy Avatar answered Oct 09 '22 21:10

Matthew Rudy


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.

like image 30
dleavitt Avatar answered Oct 09 '22 21:10

dleavitt