(Originally posted on tumblr)
Now that we have both RVM and Bundler, you’re following the advice in this article and keeping all your gems in source control, right?
No? Why not? “I have a custom fork that I don’t want to put on a public server”? Pfshaw!
1. Put a ‘:git’ option in your Gemfile pointing to your local repo:
gem ‘my_custom_gem’, ’1.0.0′, :git=>’file://path/to/your/repo’
2. Follow the steps in the article:
bundle install –path vendor’
Make sure the gem file for your custom gem is in vendor/cache.
3. Remove the :git flag in your Gemfile
gem ‘my_custom_gem’, ’1.0.0′
bundle install –path vendor
again to remove the git references from Gemfile.lock.
5. Check in vendor/cache/*, Gemfile, Gemfile.lock, and .bundle/config to source control.
There now, that wasn’t so hard. And now you don’t have to worry about losing the original git repo, or reinstalling the custom gem on every deploy.