-
Notifications
You must be signed in to change notification settings - Fork 58
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When stoping guard => spork not stoped #28
Comments
no, how do you stop guard? (the good way, is 'q' + enter) |
yes i stop guard this way |
Normally it should do it right here, can you give your Gemfile / Guardfile |
We made research and found what it breaks somewhere in this line seems like listener.stop is failing our working monkey patch is swapping lines (but it looks it can break something) def Guard.stop
UI.info "Monkey pattched bye bye...", :reset => true
guards.each { |guard| supervised_task(guard, :stop) }
listener.stop
abort
end Guardfile: guard 'livereload',
:api_version => '1.6',
:host => 'localhost',
:port => '35729',
:apply_js_live => false,
:apply_css_live => false,
:grace_period => 0.5 do
# for firefox install extension 0.6.3 or later from here: https://addons.mozilla.org/en-US/firefox/addon/livereload/versions/?page=1#version-0.6.3
# then add LR button to toolbar, and use it when you want to connect to LR server
watch(%r{app/.+\.(erb|haml)})
watch(%r{app/helpers/.+\.rb})
watch(%r{(public/|app/assets).+\.(css|js|html)})
watch(%r{(app/assets/.+\.css)\.s[ac]ss}) { |m| m[1] }
watch(%r{(app/assets/.+\.js)\.coffee}) { |m| m[1] }
watch(%r{config/locales/.+\.yml})
watch(%r{(app/stylesheets).+\.(scss)})
end
guard 'spork', :cucumber => false, :test_unit => false do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
watch(%r{^config/initializers/.*\.rb$})
watch('spec/spec_helper.rb')
end
guard 'rspec',
:version => 2,
:cli => "--drb --color",
:bundler => true,
:notification => true, #install libnotify gem to get notifications in linux => sudo gem install libnotify
:all_on_start => false,
:all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end Gemfile is too big :) |
:( this monkey patch does not properly work |
I think you're using |
Seems that it works fine without rb-inotify |
Ok, so there's certainly an issue with how rb-inotify is stopped. Please can you tell me what |
I'm seeing the same behavior. When I stop guard, it fails to kill the spork processes. Gemfile: source 'http://rubygems.org'
gem 'rails', '3.1.0'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'sqlite3', :groups => [:development, :test]
gem 'pg', :group => :staging
gem 'mysql2', :group => :production
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', " ~> 3.1.0"
gem 'coffee-rails', "~> 3.1.0"
gem 'uglifier'
end
gem 'jquery-rails'
# Use unicorn as the web server
# gem 'unicorn'
# Deploy with Capistrano
gem 'capistrano'
gem 'capistrano-ext'
# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'
group :development, :test do
gem 'cucumber-rails'
gem 'database_cleaner'
gem 'factory_girl_rails'
gem 'rspec-rails'
gem 'selenium-client'
gem 'spork', '~> 0.9.0.rc'
gem 'webrat'
gem 'rb-fsevent', :require => false if RUBY_PLATFORM =~ /darwin/i
gem 'guard-cucumber'
gem 'guard-pow'
gem 'guard-rspec'
gem 'guard-spork'
gem 'growl'
end Guardfile: # A sample Guardfile
# More info at https://github.com/guard/guard#readme
guard 'spork', :cucumber_env => { 'RAILS_ENV' => 'test' }, :rspec_env => { 'RAILS_ENV' => 'test' } do
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.+\.rb$})
watch(%r{^config/initializers/.+\.rb$})
watch('spec/spec_helper.rb')
end
guard 'cucumber', :cli => "--drb", :all_on_start => false, :all_after_pass => false do # , :cli => "--no-profile --format 'pretty'"
watch(%r{^features/.+\.feature$})
watch(%r{^features/support/.+$}) { 'features' }
watch(%r{^features/step_definitions/(.+)_steps\.rb$}) { |m| Dir[File.join("**/#{m[1]}.feature")][0] || 'features' }
end
guard 'rspec', :version => 2, :cli => '--drb', :all_on_start => false, :all_after_pass => false do
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch('spec/spec_helper.rb') { "spec" }
# Rails example
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
watch(%r{^app/controllers/(.+)_(controller)\.rb$}) { |m| ["spec/routing/#{m[1]}_routing_spec.rb", "spec/#{m[2]}s/#{m[1]}_#{m[2]}_spec.rb", "spec/acceptance/#{m[1]}_spec.rb"] }
watch(%r{^spec/support/(.+)\.rb$}) { "spec" }
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
# Capybara request specs
watch(%r{^app/views/(.+)/.*\.(erb|haml)$}) { |m| "spec/requests/#{m[1]}_spec.rb" }
end
guard 'pow' do
watch('.powrc')
watch('.powenv')
watch('.rvmrc')
watch('Gemfile')
watch('Gemfile.lock')
watch('config/application.rb')
watch('config/environment.rb')
watch(%r{^config/environments/.*\.rb$})
watch(%r{^config/initializers/.*\.rb$})
end Guard startup info ( Guard is now watching at '/Users/aporter/Developer/com/wavetronix/id'
DEBUG (10:20:08): Hook :start_begin executed for Guard::Spork
DEBUG (10:20:08): Killing Spork servers with PID:
Starting Spork for RSpec & Cucumber
DEBUG (10:20:08): Spawned Spork server 65999 ('bundle exec spork -p 8989')
DEBUG (10:20:08): Spawned Spork server 66000 ('bundle exec spork cu -p 8990')
Using Cucumber
Using RSpec
Preloading Rails environment
Preloading Rails environment
Loading Spork.prefork block...
Loading Spork.prefork block...
Spork is ready and listening on 8989!
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <top (required)> at /Users/aporter/Developer/com/wavetronix/id/features/support/env.rb:11)
DEPRECATION WARNING: class_inheritable_attribute is deprecated, please use class_attribute method instead. Notice their behavior are slightly different, so refer to class_attribute documentation first. (called from block in <top (required)> at /Users/aporter/Developer/com/wavetronix/id/features/support/env.rb:11)
Spork is ready and listening on 8990!
Spork server for RSpec & Cucumber successfully started
DEBUG (10:20:18): Command execution: growlnotify --version
DEBUG (10:20:18): Hook :start_end executed for Guard::Spork
DEBUG (10:20:18): Hook :start_begin executed for Guard::Cucumber
DEBUG (10:20:18): Hook :start_end executed for Guard::Cucumber
DEBUG (10:20:18): Hook :start_begin executed for Guard::RSpec
Guard::RSpec is running, with RSpec 2!
DEBUG (10:20:18): Hook :start_end executed for Guard::RSpec
DEBUG (10:20:18): Hook :start_begin executed for Guard::Pow
DEBUG (10:20:18): Hook :start_end executed for Guard::Pow If I run all features and specs (by pressing RETURN), and then quit (by pressing q + RETURN), I see: Bye bye...
id% But if I just start it up ( Bye bye...
DEBUG (10:21:39): Hook :stop_begin executed for Guard::Spork
DEBUG (10:21:39): Killing Spork servers with PID: 65999, 66000
DEBUG (10:21:39): Reaping spork 65999
DEBUG (10:21:39): Reaping spork 66000
DEBUG (10:21:39): Hook :stop_end executed for Guard::Spork
DEBUG (10:21:39): Hook :stop_begin executed for Guard::Cucumber
DEBUG (10:21:39): Hook :stop_end executed for Guard::Cucumber
DEBUG (10:21:39): Hook :stop_begin executed for Guard::RSpec
DEBUG (10:21:39): Hook :stop_end executed for Guard::RSpec
DEBUG (10:21:39): Hook :stop_begin executed for Guard::Pow
DEBUG (10:21:39): Hook :stop_end executed for Guard::Pow And I will sometimes see this when quitting: Bye bye...
/Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/rb-fsevent-0.4.3.1/lib/rb-fsevent/fsevent.rb:47:in `kill': No such process (Errno::ESRCH)
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/rb-fsevent-0.4.3.1/lib/rb-fsevent/fsevent.rb:47:in `stop'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/rb-fsevent-0.4.3.1/lib/rb-fsevent/fsevent.rb:42:in `run'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/guard-0.7.0/lib/guard/listeners/darwin.rb:15:in `start'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/guard-0.7.0/lib/guard.rb:45:in `start'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/guard-0.7.0/lib/guard/cli.rb:17:in `start'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/thor-0.14.6/lib/thor/task.rb:22:in `run'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/thor-0.14.6/lib/thor/invocation.rb:118:in `invoke_task'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/thor-0.14.6/lib/thor.rb:263:in `dispatch'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/thor-0.14.6/lib/thor/base.rb:389:in `start'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/gems/guard-0.7.0/bin/guard:6:in `<top (required)>'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/bin/guard:19:in `load'
from /Users/aporter/.rvm/gems/ruby-1.9.2-p290@id/bin/guard:19:in `<main>' Not quite sure why I get the sporadic behavior. For now, I just use Activity Monitor to kill the stray processes. |
That's weird it's working great for me (rspec only). But we maybe need a more aggressive way to found Spork pids on start. Please can you try the master branch to see if it's working now by adding:
to your |
Looks good, so far. I will keep watching to see if it continues to work and let you know if I run into any issues again. |
listener.stop doesn't return anything. It runs until |
And by running |
Monitoring the processes with Activity Monitor (Mac OS X), I can see the processes starting up like so:
What I've done to see this behavior is simply start guard ( |
Ok after some research, I think I have found and fixed this issue. Please can you try with the master version of guard & guard-spork:
|
Had the same issue before and it works for me, now! Good job! OS X 10.7.1
rails -v
Rails 3.1.0
ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin11.1.0]
gem list | grep -E -e "(spork|guard)"
guard (0.8.1)
guard-cucumber (0.6.3)
guard-rspec (0.4.5)
guard-spork (0.2.1)
spork (0.9.0.rc9) |
Yes, it works perfectly now. Thank you very much. |
Ok just released guard 0.8.2 & guard-spork 0.3.0 (that depends on guard 0.8.2). |
Looks good. All is right with the world. Thanks! |
is this expected behavior?
The text was updated successfully, but these errors were encountered: