Heroku is a incredible tool for deploying web apps in minutes. The problem comes when you want to deploy an with a private gem.
- Unpacking your gem in
vendor/your_gem
and link it inGemfile
:
gem 'your_gem', path: 'vendor/your_gem
Pros : Easy solution, clean.
Cons : You cannot update your gem with a simple bundler update
. You need to build new version of your gem then unpack this new version in your app.
- Using git subtree :
git subtree add --squash --prefix 'vendor/your_gem' '[email protected]:user_or_team/your_gem.git' 'master'
And in the Gemfile
:
gem 'your_gem', path: 'vendor/your_gem
This will create a git subtree for your gem in vendor/your_gems
, squashing all commit history for master
branch for your gem into one, and merge it with current app history.
Pros : Easy to use. Updating your gem can be done with a simple git subtree pull --squash --prefix 'vendor/your_gem' '[email protected]:user_or_team/your_gem.git' 'master'
Cons : It mess up your app commit history with a squash commit and a merge commit each time you add or pull.
Create a Github user with access to the repo gem. Create an Github OAuth token for this user. It's dead simple to do this over the Github API just using curl (see http://developer.github.com/v3/oauth/#oauth-authorizations-api for more).
Add the token to the git url in your Gemfile
:
gem 'your_gem', git: 'https://xxx123abc:[email protected]/user_or_team/your_gem.git'
Pros : Easy to use, easy to update, all mamanged by bundler.
Cons : Need you to expose OAuth token in Gemfile & Gemfile.lock.
see http://guides.rubygems.org/run-your-own-gem-server/
Use Gemfury : You upload you gem on gemfury
Gemfury is a tool to manage your private Gem. There are several plans, and it's designed to work great with bundler & heroku. For more information, just see Gemfury official documentation and heroku docuementation about Gemfury