Locally Save A Bundler Gem With Git Source To /vendor/cache

Posted By Weston Ganger

Sometimes I have to use a fork of a gem for a bug fix and I have to bundle my gems locally for deployment on a server that isn't connected to the public internet. This presents a problem because bundler doesn't locally save gems with git sources but it will save gems with github sources.

Here are the steps to get it to save locally. First add your gem like this in your Gemfile:

# Gemfile
gem 'chosen-rails', git: "https://github.com/westonganger/chosen-rails.git", branch: :master

Next run bundle install --path vendor/cache again to update your Gemfile.lock with the changes

Now it will be saved in /vendor/cache and be loaded locally when you bundle install --local on your server.

Related External Links:

Article Topic:Software Development - Ruby / Rails

Date:February 03, 2016