thoughtbot / appraisal

A Ruby library for testing your library against different versions of dependencies.
https://thoughtbot.com
MIT License
1.25k stars 107 forks source link

Error with the rubygems `plugin` keyword #178

Open hlascelles opened 3 years ago

hlascelles commented 3 years ago

I've recently added Diffend to my project, but am seeing the following error.

Is this the "not supported" part of the Appraisal README that says: "vendoring plugins is not supported"?

❯ bundle exec appraisal update 
Found existing alias for "bundle exec". You should use: "be"
bundler: failed to load command: appraisal (bin/appraisal)
NoMethodError: undefined method `plugin' for #<Appraisal::Gemfile:0x000055b3e8bf0ff8>
 lib/ruby/gems/2.7.0/gems/appraisal-2.3.0/lib/appraisal/gemfile.rb:22:in `run'
 lib/ruby/gems/2.7.0/gems/appraisal-2.3.0/lib/appraisal/gemfile.rb:20:in `instance_eval'
 lib/ruby/gems/2.7.0/gems/appraisal-2.3.0/lib/appraisal/gemfile.rb:20:in `run'
...
 bin/appraisal:23:in `load'
 bin/appraisal:23:in `<top (required)>'

Would you say wrapping it in !ENV["APPRAISAL_INITIALIZED"] is the canonical way of working with plugins?

nickcharlton commented 3 years ago

I've not had the opportunity to work with a plugin, but looking at this I think that's right: https://bundler.io/guides/bundler_plugins.html

You'll get a NoMethodError, as Appraisal is trying to parse the Gemfile by executing it.

I suspect wrapping it would work, yes. Give it a go and report back?

(It'd be nice to update README to link to this issue if indeed that's true!)

pboling commented 2 years ago

Having the same issue with diffend. I had hoped to add it to all my projects... but this will block a number of them.