jkutner / guard-jruby-rspec

RSpec on JRuby without the startup cost.
MIT License
62 stars 16 forks source link

guard-jruby-rspec broken for latest guard/guard-rspec 2.2.2 #38

Open greghuc opened 11 years ago

greghuc commented 11 years ago

Hi there,

Upgrading guard to latest 2.2.2 breaks guard-jruby-rspec, which fails on 'guard' startup. Error message:

19:23:42 - ERROR - Invalid Guardfile, original error is:

[#] wrong number of arguments calling initialize (2 for 1) ArgumentError: wrong number of arguments calling initialize (2 for 1) initialize at /opt/rbenv/versions/jruby-1.7.5/lib/ruby/gems/shared/gems/guard-jruby-rspec-0.2.1/lib/guard/jruby-rspec.rb:42

Root cause is recent change to Guard::RSpec initializer, removing parameters: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L11

Cheers

Greg

greghuc commented 11 years ago

And the offending line is: https://github.com/jkutner/guard-jruby-rspec/blob/master/lib/guard/jruby-rspec.rb#L42

jkutner commented 11 years ago

Cool, can you submit a PR for this? I'll get it in ASAP and cut a release.

greghuc commented 11 years ago

OK, I had an initial go at this, but I'm going to step away.

It seems that guard-rspec has also undergone a "compete rewrite", along with the changes in Guard 2.0.

My current level of knowledge of guard-jruby-rspec and these projects is sufficiently low that I'm likely to do more harm than good by attempting a fix right now. I'll leave this to someone with more understanding!

You can see the changes I made so far here: https://github.com/greghuc/guard-jruby-rspec/compare/jkutner:master...master

Here's what I discovered:

Overview of Guard upgrade: https://github.com/guard/guard/wiki/Upgrading-to-Guard-2.0

Changes to Guard::Rspec:

Guard::Rspec.run_all method logic has been pushed down into new Guard::RSpec::Runner.run_all method And the Inspector object now lives inside Runner Was: https://github.com/guard/guard-rspec/blob/v3.1.0/lib/guard/rspec.rb#L34 Now: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L26 => Either implement Guard::JRubyRSpec::Runner.run_all, or maintain logic in Guard::JRubyRSpec.run_all

Guard::RSpec now uses run_on_modifications, not run_on_changes Was: https://github.com/guard/guard-rspec/blob/v3.1.0/lib/guard/rspec.rb#L48 Now: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec.rb#L34

Not sure if Guard::JRubyRSpec::Formatters::NotificationRSpec is necessary any more. Guard::RSpec::Formatters::Notifier has an identical dump_summary method: https://github.com/guard/guard-rspec/blob/master/lib/guard/rspec/formatters/notifier.rb

ruprict commented 10 years ago

Hit this problem too. FWIW, the following allows me to work:

gem "guard", "~>1.8.3"
gem "guard-rspec"
gem "guard-jruby-rspec", github: 'jkutner/guard-jruby-rspec'

Hope that helps people use this gem until a better fix is worked out.

scottillogical commented 10 years ago

+1

swistaczek commented 10 years ago

This error stil occurs in new version of guard

vorakumar commented 10 years ago

guard is now locked at revision 2.0+, any other solution to use guard-jruby-rspec??

ianks commented 10 years ago

Having same issue as @vorakumar

dmahlow commented 10 years ago

Locking the guard-rspec to an old version that still has guard 1.8 as a dependency seems to work as a workaround:

gem "guard", "~>1.8.3"
gem "guard-rspec", "~> 3.0.3"
gem "guard-jruby-rspec", github: 'jkutner/guard-jruby-rspec'
nilbus commented 9 years ago

guard-rspec 3.0.3 requires rspec 2. Since we've updated to rspec 3, I think I'll have to address this now. Thank you @greghuc for your initial attempt and for reporting back.

nilbus commented 9 years ago

I am implementing this in an rspec3 branch.

Todo:

nilbus commented 9 years ago

I got about as far in my rspec3 branch as greghuc did earlier when I found an easier way to support RSpec 3, which is my real goal. Updating is not straightforward, and someone still needs to address this. I'm opening #40 to address rspec 3 support.