guard / guard-spork

Guard::Spork automatically manage Spork DRb servers
https://rubygems.org/gems/guard-spork
MIT License
296 stars 58 forks source link

Specific reloading #50

Closed Mange closed 12 years ago

Mange commented 12 years ago

This enables guard-spork to reload only specific spork instances.

watch('spec/spec_helper.rb') { :rspec }

I did a huge amount of refactoring since I felt it was hard to extend functionality in a nice way. Hope you guys don't mind that.

If I didn't follow some coding style I should've, just tell me and I'll fix it. Some of the styles were a bit inconsistent between files, so I did not know which one to pick.

Mange commented 12 years ago

There. I added two comments (one where we're storing it and one where we're doing the killing) to make the reasoning clear.

thibaudgg commented 12 years ago

Oops, specs seems to failed on Rubinus (http://travis-ci.org/#!/guard/guard-spork/builds/374591) Hash/Array ordering problem?

thibaudgg commented 12 years ago

hum, I just got this error after saving my environment.rb file:

ERROR: Guard::Spork failed to achieve its <run_on_change>, exception was:
NoMethodError: undefined method `kill' for RSpec:Guard::Spork::SporkInstance
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/bundler/gems/guard-spork-4f3e05161c56/lib/guard/spork/runner.rb:32:in `each'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/bundler/gems/guard-spork-4f3e05161c56/lib/guard/spork/runner.rb:32:in `kill_sporks'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/bundler/gems/guard-spork-4f3e05161c56/lib/guard/spork.rb:36:in `run_on_change'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:322:in `block in run_supervised_task'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:320:in `catch'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:320:in `run_supervised_task'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:276:in `run_on_change_task'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:215:in `block (2 levels) in run_on_change'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:254:in `block (3 levels) in run_on_guards'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:253:in `each'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:253:in `block (2 levels) in run_on_guards'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:252:in `catch'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:252:in `block in run_on_guards'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:251:in `each'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:251:in `run_on_guards'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:214:in `block in run_on_change'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:231:in `block in run'
<internal:prelude>:10:in `synchronize'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:228:in `run'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard.rb:213:in `run_on_change'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard/listener.rb:78:in `block (2 levels) in start_reactor'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard/listener.rb:74:in `loop'
/Users/Thibaud/.rvm/gems/ruby-1.9.3-p0/gems/guard-0.8.8/lib/guard/listener.rb:74:in `block in start_reactor'
Mange commented 12 years ago

Damn. I'll fix both these issues and open a new pull request. Sorry for the trouble!

thibaudgg commented 12 years ago

Ok thanks, no problem it happens!

thibaudgg commented 12 years ago

I have just modify the kill_orphan_sporks method. What do you think? https://github.com/guard/guard-spork/commit/659e67b38ebf758bb5782f6ecdd9ced6fbcdd38e

Mange commented 12 years ago

Looks good!