Ruby Gemspec Dependency: Is possible have a git branch dependency?

Luca G. Soave picture Luca G. Soave · Jun 27, 2011 · Viewed 37.5k times · Source

Is possible have a git branch dependency, inside mygem.gemspec?

I'm thinking something similar to the following:

gem.add_runtime_dependency 'oauth2', :git => '[email protected]:lgs/oauth2.git'

... but it doesn't work.

Answer

gtd picture gtd · Jun 28, 2011

This is not possible, and likely never will be because it would be rather heavy-handed for RubyGems to allow gem developers to require that users have a specific version control system installed to access a gem. Gems should be self-contained with a minimal number of dependencies so that people can use them in as wide an array of application as possible.

If you want to do this for your own internal projects, my suggestion would be to use Bundler which supports this quite well.