ManageIQ / bundler-inject

A bundler plugin that allows extension of a project with personal and overridden gems
Apache License 2.0
21 stars 8 forks source link

override_gem doesn't override a transient dependency #11

Open Fryguy opened 4 years ago

Fryguy commented 4 years ago

In ManageIQ, if I do

override_gem "azure-armrest", :path => "~/dev/azure-armrest"

I get the following error

Installing bundler-inject 1.1.0

[!] There was an error parsing `Gemfile.local.rb`: Trying to override unknown gem "azure-armrest". Bundler cannot continue.

 #  from /Users/jfrey/dev/manageiq/bundler.d/Gemfile.local.rb:7
 #  -------------------------------------------
 #  #
 >  override_gem "azure-armrest", :path => "/Users/jfrey/dev/manageiq-cross_repo-tests/repos/ManageIQ/azure-armrest@a28277d722984416a782f940da907e7a5cb7f036"
 #  -------------------------------------------

Even though it's a transient dependency, I'd expect it to work.

kbrock commented 3 years ago

I think this intentionally blows up when it does not know the gem. The gem is not available (yet) so it complains.

Do you want to be able to override gems that are not part of the gemfile at all and have them act like a gem command? I do something like that in my own Gemfiles

agrare commented 3 years ago

Didn't we add ensure_gem for this?

Fryguy commented 3 years ago

No, this is a different issue from ensure_gem.

Fryguy commented 3 years ago

Though that being said, maybe ensure_gem would work for this case? If so, we should document that.

agrare commented 3 years ago

If the issue is that the gem you're trying to override isn't in the main Gemfile but rather brought in by another gem, then I use ensure_gem for this all the time...basically anytime I need to override a provider sdk gem.

agrare commented 3 years ago

Maybe that's an "undocumented" use case of ensure_gem but it 100% works :smile:

Fryguy commented 3 years ago

Ok, interesting - yeah then we should at least document it in the README, and then we can close this, or change it to a feature request.