Reputation: 846
If I've built a private gem (hosted internally at my company, for instance), then I want to reuse that gem in another gem (not app!) that I'm building, how do I do that?
Where do I put my dependencies and tell my new gem how to find the old (already built) privately hosted gem?
Upvotes: 3
Views: 824
Reputation: 846
So this took me awhile to figure out, because the answer is, it's in TWO places. Do this:
source 'http://rubygems.org' source 'http://myrubygems.mycompany.example.com:8808' # Or wherever your gems are hosted internally (or externally) gemspec
Gem::Specification.new do |gem| # [...] gem.add_dependency 'myoldgem' # the gem hosted at myrubygems.mycompany.example.com:8808 end
The reason this works is probably obvious: Your Gemfile specifies the source for your gems and your .gemspec specifies the dependencies.
Hope this saves someone a few minutes.
Upvotes: 5