ayckoster ayckoster - 7 months ago 11
Ruby Question

Is it possible to bundle / install gems from a local cache?

I have bunch of gems on my computer that I want to use in a chef recipe.

I know it is possible to put them in a directory like /tmp/gems and just:

cd /tmp/gems
gem install *.gem


Is it possible to put all gems in one directory where I can install them with bundler without downloading them again?

cd /somedir/my_rails_project
bundle


I want to save bandwidth.

Answer

You can add local directories to your Gemfile (example from the docs):

gem "nokogiri", :path => "~/sw/gems/nokogiri"

Alternatively, you can set up a local Git repository with the gems in it and write a Gemfile like this:

gem "gem1", :git    => "file:///tmp/gems",
            :branch => "gem1"