Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Specify git path in gemspec add_dependency entry

Tags:

bundler

gem

I have git-forked two gems (say foo and bar), one depending on the other:

foo.gemspec

...
s.add_dependency "bar"

I want my fork of foo to depend on my fork of bar, not on the original bar gem.

However this doesn't work:

s.add_dependency "bar", git: 'git:github.com/vemv/bar.git' # => ArgumentError!

How to specify the source of a dependency in a .gemspec file?

If not possible, what to do instead?

like image 568
deprecated Avatar asked Oct 21 '13 12:10

deprecated


1 Answers

no, it is not possible to do this in a .gemspec file.

i think that you are referring to the Bundler git feature, as the syntax looks the same.

so for the development of your forked gem, you will have to set up the dependency in the Gemfile and remove it from the .gemspec file.

i assume that you are using both a 3rd application, that you are not referring to in your question. i think that the simplest solution would be to use the Bundler :path feature to reference both gems directly. this will not work in scenarios where you would want to deploy it unless you vendor the gems with your app.

overall, this is a tricky thing. especially if you just want to fix a dependency or any other minor thing in a 3rd party lib. Bundler is not flexible in this regard.

like image 106
phoet Avatar answered Nov 02 '22 13:11

phoet