From 18cb3471afa4a92394b29c0f0fe730d88f23be6b Mon Sep 17 00:00:00 2001 From: Thibaud Guillaume-Gentil Date: Sat, 3 Sep 2011 14:16:32 +0200 Subject: [PATCH] Try to debug linux spec on travis --- lib/guard/listener.rb | 17 ++++++++++++++++- spec/guard/listeners/polling_spec.rb | 2 +- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/lib/guard/listener.rb b/lib/guard/listener.rb index 2a53b85..6c400d6 100644 --- a/lib/guard/listener.rb +++ b/lib/guard/listener.rb @@ -42,6 +42,7 @@ module Guard def start_reactor return if ENV["GUARD_ENV"] == 'test' + p "start_reactor" Thread.new do loop do if @changed_files != [] && !@locked @@ -86,6 +87,8 @@ module Guard last_event = @last_event.dup update_last_event files = potentially_modified_files(dirs, options).select { |path| file_modified?(path, last_event) } + p "modified_files" + p files relativize_paths(files) end @@ -143,13 +146,25 @@ module Guard # Depending on the filesystem, mtime is probably only precise to the second, so round # both values down to the second for the comparison. def file_modified?(path, last_event) + p path + p last_event.to_i + p File.ctime(path).to_i if File.ctime(path).to_i == last_event.to_i - file_content_modified?(path, sha1_checksum(path)) + p "File.ctime == last_event" + res = file_content_modified?(path, sha1_checksum(path)) + p res.to_s + res elsif File.ctime(path).to_i > last_event.to_i + p "File.ctime > last_event" set_sha1_checksums_hash(path, sha1_checksum(path)) + p "true" true + else + p "false" + false end rescue + p "false" false end diff --git a/spec/guard/listeners/polling_spec.rb b/spec/guard/listeners/polling_spec.rb index 072421e..d6fcc29 100644 --- a/spec/guard/listeners/polling_spec.rb +++ b/spec/guard/listeners/polling_spec.rb @@ -4,6 +4,6 @@ require 'guard/listeners/polling' describe Guard::Polling do subject { Guard::Polling } - it_should_behave_like "a listener that reacts to #on_change" + it_should_behave_like "a listener that reacts to #on_change", 2 it_should_behave_like "a listener scoped to a specific directory" end