burke / zeus

Boot any rails app in under a second.
MIT License
3.33k stars 231 forks source link

Guard does not use zeus if model file changed #273

Open Darkside73 opened 11 years ago

Darkside73 commented 11 years ago

I'm not sure about right place for issue but: guard-rspec developer pretty confident that it is not related to guard-rspec and guard-zeus project seems to be dead.

Zeus and guard start smoothly without any issues. Guard runs within bundler

When guard starts all specs running with zeus speed. But when changing rails model guard runs corresponding spec slowly same as without zeus. Weird and confusing thing: when changing model spec, helper spec or even helper itself guard runs corresponding specs quickly again. Cucumber features always run speedy no matter of file initiator.

Running guard with --debug option confirms issue. There are no diff between slow and quick running except executing "rspec --help" additionally in "quick" case

Case 1: change model spec (quick running ~1 sec)

17:32:45 - DEBUG - Stop interactor
17:32:45 - DEBUG - Command execution: hash stty
17:32:45 - DEBUG - Trying to run Guard::RSpec#run_on_modifications with ["spec/models/category_spec.rb"]
17:32:45 - DEBUG - Hook :run_on_changes_begin executed for Guard::RSpec
17:32:45 - INFO - Running: spec/models/category_spec.rb
17:32:45 - DEBUG - Command execution: rspec --help
17:32:45 - DEBUG - Command execution: zeus rspec -f documentation -r /home/darkside/.rvm/gems/ruby-1.9.3-p392@global/gems/guard-rspec-2.4.1/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2 spec/models/category_spec.rb 

Category
  arrange
    should respond to #each

Finished in 0.39101 seconds
1 example, 0 failures
17:32:47 - DEBUG - Hook :run_on_changes_end executed for Guard::RSpec
17:32:47 - DEBUG - Command execution: hash stty
17:32:47 - DEBUG - Start interactor

Case 2: change model itself (slow running ~7 sec)

17:35:04 - DEBUG - Stop interactor
17:35:04 - DEBUG - Command execution: hash stty
17:35:04 - DEBUG - Trying to run Guard::RSpec#run_on_modifications with ["spec/models/category_spec.rb"]
17:35:04 - DEBUG - Hook :run_on_changes_begin executed for Guard::RSpec
17:35:04 - INFO - Running: spec/models/category_spec.rb
17:35:04 - DEBUG - Command execution: zeus rspec -f documentation -r /home/darkside/.rvm/gems/ruby-1.9.3-p392@global/gems/guard-rspec-2.4.1/lib/guard/rspec/formatter.rb -f Guard::RSpec::Formatter --failure-exit-code 2 spec/models/category_spec.rb 

Category
  arrange
    should respond to #each

Finished in 0.39101 seconds
1 example, 0 failures
17:35:11 - DEBUG - Hook :run_on_changes_end executed for Guard::RSpec
17:35:11 - DEBUG - Command execution: hash stty
17:35:11 - DEBUG - Start interactor

Ruby version

ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]

Rails version

Rails 3.2.12

Gemfile (the meaning part); all gems have latest versions.

group :development, :test do
  gem 'rspec-rails'
  gem 'guard-rspec'
  gem 'guard-cucumber'
  gem 'zeus'
end

group :test do
  gem 'cucumber-rails', require: false
  gem 'capybara'
  gem 'shoulda'
end

Guardfile

guard 'rspec', zeus: true, bundler: 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{^app/(.+)\.rb$})                           { |m| "spec/#{m[1]}_spec.rb" }
  watch(%r{^app/(.*)(\.erb|\.slim)$})                 { |m| "spec/#{m[1]}#{m[2]}_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/factories/(.+)\.rb$})                { ["spec/models"] }
  watch(%r{^spec/support/(.+)\.rb$})                  { "spec" }
  watch('config/routes.rb')                           { "spec/routing" }
  watch('app/controllers/application_controller.rb')  { "spec/controllers" }
}
end

guard 'cucumber', command_prefix: 'zeus', bundler: false do
  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

In addition: if change factory girl file guard runs specs slowly as well

Issue discussion in guard-rspec repo: https://github.com/guard/guard-rspec/issues/163

shanemcd commented 11 years ago

I am experiencing the same issue. Has anyone gotten the chance to look into this?

christhekeele commented 11 years ago

+1

Darkside73 commented 11 years ago

Glad to know that I'm not alone with it) BTW: changing controllers, routes.rb has same issue

simonmorley commented 11 years ago

Mine's gone the same way too this evening. Can't figure it out.

mattcl commented 11 years ago

I have just started to experience this as well. I have shut down Guard and have noticed that changing a model file still triggers zeus to reload the entire application (with most of the time spent waiting on the test and development environments. Changing other things, like controllers and test files do not produce the same reloading. It would seem that this is not an issue with Guard, though it was working fine for me earlier. I do not know what has changed.

Darkside73 commented 11 years ago

In my case:

Maybe its by design?

dkubb commented 11 years ago

I'm seeing the same thing too. When I change a spec, it is executed immediately, but when I change a model zeus reloads the test environment and guard-rspec waits until environment is ready before it can begin running the specs.

I'm guessing this is by design since the way zeus is doing it is fairly safe, but I wonder if there's more that can be done by relying more on rails' own code reloading?

s-andringa commented 11 years ago

I'm experiencing the same problem. When I change a model the test environment, and sometimes also the development environment is reloaded. Changing routes.rb also reloads both environments. Controllers are okay. Also without Guard running. Same results for Zeus versions 0.13.2 and 0.13.3.rc2. It worked fine before, no clue what change could have caused this behavior.

karellm commented 11 years ago

+1

doredesign commented 11 years ago

+1

mattcl commented 11 years ago

I've noticed that this seems to only happen to models that I'm using with devise (User, Admin, whatnot), but I haven't had the time to dig much deeper.

williamhc commented 11 years ago

+1

zoopyserg commented 11 years ago

same thing.