Closed ali-bugdayci closed 10 years ago
All seems fine for me, what didn't work? Do you have a special file structure for your specs? Please try to run guard in debug mode bundle exec guard -d
and give the output when you try to run specify spec/model file.
I After struggling for half a day, it magically works now. Didnt change anything, but let you guys know if something else happens.
Ok great, I hope you'll find what changed.
Well I dont know if it affected but I upgraded gems with "gem update --system", and run "gem pristine --all" to rebuild the gems.
Thanks for the support and the great project :)
Sorry to bring this up again but seems like my problem is still there. Would like to get any hints you can provide:
~/code/fatih[master*]% guard -v
Guard version 2.2.5
~/code/fatih[master*]% guard -d
18:13:33 - DEBUG - Stop interactor
18:13:33 - DEBUG - Trying to run Guard::RSpec#run_on_additions with ["spec/features/cities_spec.rb"]
18:13:33 - DEBUG - Trying to run Guard::RSpec#run_on_changes with ["spec/features/cities_spec.rb"]
18:13:33 - DEBUG - Trying to run Guard::RSpec#run_on_change with ["spec/features/cities_spec.rb"]
18:13:33 - DEBUG - Start interactor
[1] guard(main)>
18:14:20 - DEBUG - Command execution: stty 5500:5:bf:8a3b:3:1c:7f:15:4:0:1:0:11:13:1a:0:12:f:17:16:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0:0
[1] guard(main)>
18:14:20 - INFO - Run all
18:14:20 - DEBUG - Hook :run_all_begin executed for Guard::RSpec
18:14:20 - INFO - Running all specs
...."/cities/1/edit"
....*
Pending:
City add some examples to (or delete) /mnt/ramdisk/fatih/spec/models/city_spec.rb
# No reason given
# ./spec/models/city_spec.rb:4
Finished in 0.3135 seconds
9 examples, 0 failures, 1 pending
Randomized with seed 24679
18:14:22 - DEBUG - Hook :run_all_end executed for Guard::RSpec
18:14:22 - DEBUG - Hook :run_all_begin executed for Guard::Bundler
18:14:22 - DEBUG - Command execution: bundle check
18:14:23 - INFO - Bundle already up-to-date
18:14:23 - DEBUG - Hook :run_all_end executed for Guard::Bundler
18:14:23 - DEBUG - Hook :run_all_begin executed for Guard::Migrate
18:14:23 - DEBUG - Hook :run_all_end executed for Guard::Migrate
18:14:23 - DEBUG - Command execution: stty -a
18:14:23 - DEBUG - Stop interactor
18:14:23 - DEBUG - Start interactor
18:14:23 - DEBUG - Command execution: stty -a
18:14:23 - DEBUG - Command execution: stty -g
18:14:23 - DEBUG - Command execution: stty -a
18:14:23 - DEBUG - Command execution: stty -a
18:14:23 - DEBUG - Command execution: stty -echo -icrnl cbreak pass8 -ixoff
18:14:23 - DEBUG - Stop interactor
18:14:23 - DEBUG - Start interactor
~/code/fatih[master*]% which bundle
/home/bor/.rbenv/shims/bundle
~/code/fatih[master*]% bundle -v
Bundler version 1.5.1
~/code/fatih[master*]% which gem
/home/bor/.rbenv/shims/gem
~/code/fatih[master*]% gem -v
2.2.0
~/code/fatih[master*]% which guard
guard: aliased to bundled_guard
~/code/fatih[master*]% guard -v
Guard version 2.2.5
~/code/fatih[master*]% rbenv versions
system
1.9.3-p484
* 2.0.0-p353 (set by /home/bor/.rbenv/version)
2.1.0
~/code/fatih[master*]% gem environment
RubyGems Environment:
- RUBYGEMS VERSION: 2.2.0
- RUBY VERSION: 2.0.0 (2013-11-22 patchlevel 353) [x86_64-linux]
- INSTALLATION DIRECTORY: /home/bor/.rbenv/versions/2.0.0-p353/lib/ruby/gems/2.0.0
- RUBY EXECUTABLE: /home/bor/.rbenv/versions/2.0.0-p353/bin/ruby
- EXECUTABLE DIRECTORY: /home/bor/.rbenv/versions/2.0.0-p353/bin
- SPEC CACHE DIRECTORY: /home/bor/.gem/specs
GEM
remote: https://rubygems.org/
specs:
actionmailer (4.0.2)
actionpack (= 4.0.2)
mail (~> 2.5.4)
actionpack (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
erubis (~> 2.7.0)
rack (~> 1.5.2)
rack-test (~> 0.6.2)
activemodel (4.0.2)
activesupport (= 4.0.2)
builder (~> 3.1.0)
activerecord (4.0.2)
activemodel (= 4.0.2)
activerecord-deprecated_finders (~> 1.0.2)
activesupport (= 4.0.2)
arel (~> 4.0.0)
activerecord-deprecated_finders (1.0.3)
activesupport (4.0.2)
i18n (~> 0.6, >= 0.6.4)
minitest (~> 4.2)
multi_json (~> 1.3)
thread_safe (~> 0.1)
tzinfo (~> 0.3.37)
addressable (2.3.5)
arel (4.0.1)
atomic (1.1.14)
better_errors (1.1.0)
coderay (>= 1.0.0)
erubis (>= 2.6.6)
binding_of_caller (0.7.2)
debug_inspector (>= 0.0.1)
builder (3.1.4)
bullet (4.7.1)
activesupport
uniform_notifier (>= 1.4.0)
callsite (0.0.11)
capistrano (3.0.1)
i18n
rake (>= 10.0.0)
sshkit (>= 0.0.23)
capybara (2.2.0)
mime-types (>= 1.16)
nokogiri (>= 1.3.3)
rack (>= 1.0.0)
rack-test (>= 0.5.4)
xpath (~> 2.0)
capybara-webkit (1.1.0)
capybara (~> 2.0, >= 2.0.2)
json
celluloid (0.15.2)
timers (~> 1.1.0)
coderay (1.1.0)
coffee-rails (4.0.1)
coffee-script (>= 2.2.0)
railties (>= 4.0.0, < 5.0)
coffee-script (2.2.0)
coffee-script-source
execjs
coffee-script-source (1.6.3)
commonjs (0.2.7)
database_cleaner (1.2.0)
debug_inspector (0.0.2)
diff-lcs (1.2.5)
docile (1.1.1)
em-websocket (0.5.0)
eventmachine (>= 0.12.9)
http_parser.rb (~> 0.5.3)
erubis (2.7.0)
eventmachine (1.0.3)
execjs (2.0.2)
factory_girl (4.3.0)
activesupport (>= 3.0.0)
factory_girl_rails (4.3.0)
factory_girl (~> 4.3.0)
railties (>= 3.0.0)
ffi (1.9.3)
formatador (0.2.4)
fuubar (1.3.2)
rspec (>= 2.14.0, < 3.1.0)
ruby-progressbar (~> 1.3)
guard (2.2.5)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-bundler (2.0.0)
bundler (~> 1.0)
guard (~> 2.2)
guard-livereload (2.0.1)
em-websocket (~> 0.5)
guard (~> 2.0)
multi_json (~> 1.8)
guard-migrate (1.0.0)
guard (>= 1.3.0)
guard-rspec (4.2.3)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
has_scope (0.6.0.rc)
actionpack (>= 3.2, < 5)
activesupport (>= 3.2, < 5)
hike (1.2.3)
http_parser.rb (0.5.3)
i18n (0.6.9)
inherited_resources (1.4.1)
has_scope (~> 0.6.0.rc)
responders (~> 1.0.0.rc)
jbuilder (1.5.3)
activesupport (>= 3.0.0)
multi_json (>= 1.2.0)
jquery-rails (3.0.4)
railties (>= 3.0, < 5.0)
thor (>= 0.14, < 2.0)
json (1.8.1)
launchy (2.4.2)
addressable (~> 2.3)
less (2.3.3)
commonjs (~> 0.2.6)
less-rails (2.3.3)
actionpack (>= 3.1)
less (~> 2.3.1)
libnotify (0.8.2)
ffi (>= 1.0.11)
libv8 (3.11.8.17)
listen (2.4.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
lumberjack (1.0.4)
mail (2.5.4)
mime-types (~> 1.16)
treetop (~> 1.4.8)
meta_request (0.2.8)
callsite
rack-contrib
railties
method_source (0.8.2)
mime-types (1.25.1)
mini_portile (0.5.2)
minitest (4.7.5)
multi_json (1.8.2)
net-scp (1.1.2)
net-ssh (>= 2.6.5)
net-ssh (2.7.0)
nokogiri (1.6.1)
mini_portile (~> 0.5.0)
parallel (0.9.1)
parallel_tests (0.16.6)
parallel
polyglot (0.3.3)
pry (0.9.12.4)
coderay (~> 1.0)
method_source (~> 0.8)
slop (~> 3.4)
pry-doc (0.5.1)
pry (>= 0.9)
yard (>= 0.8)
pry-rails (0.3.2)
pry (>= 0.9.10)
rack (1.5.2)
rack-contrib (1.1.0)
rack (>= 0.9.1)
rack-mini-profiler (0.1.31)
rack (>= 1.1.3)
rack-test (0.6.2)
rack (>= 1.0)
rails (4.0.2)
actionmailer (= 4.0.2)
actionpack (= 4.0.2)
activerecord (= 4.0.2)
activesupport (= 4.0.2)
bundler (>= 1.3.0, < 2.0)
railties (= 4.0.2)
sprockets-rails (~> 2.0.0)
rails-footnotes (3.7.9)
rails (>= 3.0.0)
railties (4.0.2)
actionpack (= 4.0.2)
activesupport (= 4.0.2)
rake (>= 0.8.7)
thor (>= 0.18.1, < 2.0)
rake (10.1.1)
rb-fsevent (0.9.4)
rb-inotify (0.9.3)
ffi (>= 0.5.0)
rb-readline (0.5.0)
rdoc (3.12.2)
json (~> 1.4)
ref (1.0.5)
responders (1.0.0)
railties (>= 3.2, < 5)
route_translator (3.1.0)
rspec (2.14.1)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
diff-lcs (>= 1.1.3, < 2.0)
rspec-instafail (0.2.4)
rspec-mocks (2.14.4)
rspec-rails (2.14.1)
actionpack (>= 3.0)
activemodel (>= 3.0)
activesupport (>= 3.0)
railties (>= 3.0)
rspec-core (~> 2.14.0)
rspec-expectations (~> 2.14.0)
rspec-mocks (~> 2.14.0)
ruby-progressbar (1.4.0)
sass (3.2.13)
sass-rails (4.0.1)
railties (>= 4.0.0, < 5.0)
sass (>= 3.1.10)
sprockets-rails (~> 2.0.0)
sdoc (0.3.20)
json (>= 1.1.3)
rdoc (~> 3.10)
shoulda (3.5.0)
shoulda-context (~> 1.0, >= 1.0.1)
shoulda-matchers (>= 1.4.1, < 3.0)
shoulda-context (1.1.6)
shoulda-matchers (2.4.0)
activesupport (>= 3.0.0)
simple_form (3.0.1)
actionpack (>= 4.0.0, < 4.1)
activemodel (>= 4.0.0, < 4.1)
simplecov (0.8.2)
docile (~> 1.1.0)
multi_json
simplecov-html (~> 0.8.0)
simplecov-html (0.8.0)
slop (3.4.7)
spring (1.0.0)
spring-commands-rspec (1.0.1)
spring (>= 0.9.1)
sprockets (2.10.1)
hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0)
tilt (~> 1.1, != 1.3.0)
sprockets-rails (2.0.1)
actionpack (>= 3.0)
activesupport (>= 3.0)
sprockets (~> 2.8)
sqlite3 (1.3.8)
sshkit (1.3.0)
net-scp (>= 1.1.2)
net-ssh
term-ansicolor
term-ansicolor (1.2.2)
tins (~> 0.8)
therubyracer (0.11.4)
libv8 (~> 3.11.8.12)
ref
thor (0.18.1)
thread_safe (0.1.3)
atomic
tilt (1.4.1)
timers (1.1.0)
tins (0.13.1)
treetop (1.4.15)
polyglot
polyglot (>= 0.3.1)
turbolinks (2.1.0)
coffee-rails
twitter-bootstrap-rails (2.2.8)
actionpack (>= 3.1)
execjs
rails (>= 3.1)
railties (>= 3.1)
tzinfo (0.3.38)
uglifier (2.4.0)
execjs (>= 0.3.0)
json (>= 1.8.0)
uniform_notifier (1.4.0)
will_paginate (3.0.5)
xpath (2.0.0)
nokogiri (~> 1.3)
yard (0.8.7.3)
zeus (0.13.4.pre2)
method_source (>= 0.6.7)
zeus-parallel_tests (0.2.4)
parallel_tests (>= 0.11.3)
zeus (~> 0.13.3)
PLATFORMS
ruby
DEPENDENCIES
better_errors
binding_of_caller
bullet (~> 4.7.1)
capistrano
capybara (~> 2.2.0)
capybara-webkit (~> 1.1.0)
coffee-rails (~> 4.0.0)
database_cleaner (~> 1.2.0)
factory_girl_rails (~> 4.3.0)
fuubar (~> 1.3.2)
guard (~> 2.2.5)
guard-bundler (~> 2.0.0)
guard-livereload (~> 2.0.1)
guard-migrate
guard-rspec (~> 4.2.3)
inherited_resources (~> 1.4.1)
jbuilder (~> 1.2)
jquery-rails
launchy (~> 2.4.2)
less-rails (~> 2.3.2)
libnotify
meta_request
parallel_tests (~> 0.16.6)
pry-doc
pry-rails
rack-mini-profiler
rails (= 4.0.2)
rails-footnotes
rb-readline
route_translator
rspec (~> 2.14.1)
rspec-instafail (~> 0.2.4)
rspec-rails (~> 2.14.1)
sass-rails (~> 4.0.0)
sdoc
shoulda (~> 3.5.0)
simple_form (~> 3.0.1)
simplecov (~> 0.8.2)
spring (~> 1.0.0)
spring-commands-rspec
sqlite3
therubyracer (~> 0.11.4)
turbolinks
twitter-bootstrap-rails (~> 2.2.6)
uglifier (>= 1.3.0)
will_paginate (~> 3.0.5)
zeus (= 0.13.4.pre2)
zeus-parallel_tests (~> 0.2.4)
Sorry but I've no idea. :-/
I have exactly the same problem here. I am getting
guard -d
.....
14:12:12 - DEBUG - Trying to run Guard::RSpec#run_on_additions with ["spec/requests/categories_spec.rb"]
14:12:12 - DEBUG - Trying to run Guard::RSpec#run_on_changes with ["spec/requests/categories_spec.rb"]
14:12:12 - DEBUG - Trying to run Guard::RSpec#run_on_change with ["spec/requests/categories_spec.rb"]
14:12:12 - DEBUG - Start interactor
when I change a file that is listened by Guard RSpec.
This happens when I am using rb-inotify
to listen for changes.
The odd thing about it is that it works perfectly when falling back to polling
guard -dp
....
14:14:43 - DEBUG - Hook :run_on_modifications_begin executed for Guard::RSpec
14:14:43 - INFO - Running: spec/requests/categories_spec.rb
If that could help, here are the versions in my Gemfile.lock file.
guard-rspec (4.0.0)
guard (~> 2.0)
rspec (~> 2.14)
guard (2.0.5)
formatador (>= 0.2.4)
listen (~> 2.0)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
listen (2.0.4)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
Hi,
Can you try the latest version so that they can look into it: guard-rspec (4.2.3)
Hi,
Sure, I just ran gem update
and tried with the following versions and still get the same problem.
guard (2.2.5)
formatador (>= 0.2.4)
listen (~> 2.1)
lumberjack (~> 1.0)
pry (>= 0.9.12)
thor (>= 0.18.1)
guard-rspec (4.2.4)
guard (~> 2.1)
rspec (>= 2.14, < 4.0)
listen (2.4.0)
celluloid (>= 0.15.2)
rb-fsevent (>= 0.9.3)
rb-inotify (>= 0.9)
And if it could be of any help, here are some extra info.
$ ruby --version
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-linux]
$ uname -a
Linux localhost 3.12.6-1-ARCH #1 SMP PREEMPT Fri Dec 20 19:39:00 CET 2013 x86_64 GNU/Linux
This happens when I am using rb-inotify to listen for changes. The odd thing about it is that it works perfectly when falling back to polling
@thibaudgg @tuvistavie Whether it can be a problem with guard listener?
Yeah it certainly come from Listen and rb-inotify.
@tuvistavie have you a lot files to listen on in your app? Maybe try to ignore some files: https://github.com/guard/guard#ignore
Hi,
My environment is linux too (Ubuntu 12.04). I am using: gem "libnotify". I tested with removing the gem from the Gemfile without any luck (no changes.
When I change a spec file guard gives me the following output, but does not run the specs:
15:42:20 - DEBUG - Stop interactor
15:42:20 - DEBUG - Trying to run Guard::RSpec#run_on_additions with ["spec/features/cities_spec.rb"]
15:42:20 - DEBUG - Trying to run Guard::RSpec#run_on_changes with ["spec/features/cities_spec.rb"]
15:42:20 - DEBUG - Trying to run Guard::RSpec#run_on_change with ["spec/features/cities_spec.rb"]
15:42:20 - DEBUG - Start interactor
[1] guard(main)>
I dont have much files to listen too. Its a new starting project. Any thoughts?
Thank you for the answers.
@tuvistavie have you a lot files to listen on in your app?
No it is a Rails application I have started recently so I do not have so many files.
$ ls **/*.{html,slim,rb,yml,feature,coffee,css} | wc -l
128
Just to be sure I tried with only
require 'active_support/core_ext'
guard 'rspec' do
watch('spec/spec_helper.rb') { "spec" }
end
in my Guardfile but that did not change anything.
Here is my full Guardfile (which is I almost exactly what has been generated).
require 'active_support/core_ext'
guard 'livereload' do
watch(%r{app/views/.+\.(erb|haml|slim)$})
watch(%r{app/helpers/.+\.rb})
watch(%r{public/.+\.(css|js|html)})
watch(%r{config/locales/.+\.yml})
# Rails Assets Pipeline
watch(%r{(app|vendor)/assets/\w+/(.+\.(less|css|js|html)).*}) { |m| "/assets/#{m[2]}" }
end
guard 'rspec' do
watch('spec/spec_helper.rb') { "spec" }
watch('config/routes.rb') { "spec/routing" }
watch('app/controllers/application_controller.rb') { "spec/controllers" }
watch(%r{^spec/.+_spec\.rb$})
watch(%r{^app/(.+)\.rb$}) { |m| "spec/#{m[1]}_spec.rb" }
watch(%r{^app/(.*)(\.erb|\.haml|\.slim)$}) { |m| "spec/#{m[1]}#{m[2]}_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"] }
end
guard 'spinach' do
watch(%r{^features/(.*)\.feature})
watch(%r{^features/steps/(.*)([^/]+)\.rb}) do |m|
"features/#{m[1]}#{m[2]}.feature"
end
end
guard 'spork', rspec_env: { RAILS_ENV: 'test' },
cucumber: false,
test_unit: false do
watch('config/application.rb')
watch('config/routes.rb')
watch('config/environment.rb')
watch('config/environments/test.rb')
watch(%r{^config/initializers/.+\.rb$})
watch('Gemfile.lock')
watch('spec/spec_helper.rb') { :rspec }
watch('test/test_helper.rb') { :test_unit }
watch(%r{features/support/}) { :cucumber }
end
For some reason, spork and spinach work correctly while livereload and rspec only work when using polling.
@thibaudgg @tuvistavie Whether it can be a problem with guard listener?
Yeah it certainly come from Listen and rb-inotify.
As I am having the same issue with livereload I suppose this has probably more to do with rb-notify or Guard itself, but as spinach and spork do work correctly I am having some issues understanding where could the problem come from.
@tuvistavie have you try with another text editor?
I have exactly the same problem.
I am using SublimeText 3.
When savingg the file, I see the debugging output like @ali-bugdayci posted. When instead I touch the file, suddenly my specs run.
You need to turn off atomic_save "atomic_save": false
: http://kiwidev.wordpress.com/2013/10/11/ruby-guard-not-seeing-changes-when-saving-in-sublime-text-on-linux/
@thibaudgg that solved it for me, thank you!
@tuvistavie This is possibly a different error. I have livereload, bundler and brakeman working fine with the notifications.
I am using different editors on different evironments, SublimeText <"atomic_save": false> worked for me too.I didnt suspect editor, since the same atomic_save true setting does not break livereload, or bundler listen's.
Anyway, you can close the issue after tuvistavie's issue is resolved.
You need to turn off atomic_save "atomic_save": false
This solved the problem for me too, thank you very much for your time.
@thibaudgg Thank you very much for the solution :+1:
@asaletnik you're welcome!
FYI, in RubyMine I needed to disable "safe write" to make guard see changes. http://stackoverflow.com/a/12000765/149264
@thibaudgg Thanks for the solution!
@hiveer you're welcome!
@thibaudgg Thanks for that, never occurred to me that this boil down to my text editor.
Hi,
I made some extensive tests with different versions but could not make guard work with the latest guard-rspec.
I tested both 4.2.3 release and 4.1.1 releases. I also tested with a fresh Guardfile created with "guard init" in case I made a guardfile mistake. I checked if the problem is with guard or listen by writing into a file the date inside the watch block, which works (See the guardfile below)
For the guardfile below, when I edit a view (i.e. new.html.erb) inside cities, the spec/features/cities_spec.rb does not run, whereas e.g. livereload reloads the page. When I run all the tests on guard, it runs the tests (added as refrence to the end)
Configurations I tested are below:
Tested GuardFile generated by guard init:
Gemfile.lock for version 4.2.3:
Gemfile.lock for version 4.1.1:
A sample guard run all specs