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?
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With