How To Run A Custom Ruby Gem From Any Path

You can run custom ruby gems from any path, for instance local machine, LAN or remotely, without the necessity to go over the official ruby gem index.

Specifying a :path attribute will install the gem from that path on your local machine.

gem "foreman", :path => "/Users/pje/my_foreman_fork"

Alternately, specifying a :git attribute will install the gem from a remote git repository.

gem "foreman", :git => "git://github.com/pje/foreman.git"

# ...or at a specific SHA-1 ref
gem "foreman", :git => "git://github.com/pje/foreman.git", :ref => "bf648a070c"

# ...or branch
gem "foreman", :git => "git://github.com/pje/foreman.git", :branch => "jruby"

# ...or tag
gem "foreman", :git => "git://github.com/pje/foreman.git", :tag => "v0.45.0"

Also, for some firewalls the git protocol may be an issue. In such cases try using https instead.

gem "foreman", :git => "https://github.com/pje/foreman.git"

StackOverflow