Travis test
This commit is contained in:
parent
41127e2cbf
commit
8b66b71716
@ -87,8 +87,8 @@ module Guard
|
|||||||
last_event = @last_event
|
last_event = @last_event
|
||||||
update_last_event
|
update_last_event
|
||||||
files = potentially_modified_files(dirs, options).select { |path| file_modified?(path, last_event) }
|
files = potentially_modified_files(dirs, options).select { |path| file_modified?(path, last_event) }
|
||||||
p "modified_files"
|
# p "modified_files"
|
||||||
p files
|
# p files
|
||||||
relativize_paths(files)
|
relativize_paths(files)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -143,30 +143,31 @@ module Guard
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Depending on the filesystem, mtime is probably only precise to the second, so round
|
# Depending on the filesystem, mtime/ctime is probably only precise to the second, so round
|
||||||
# both values down to the second for the comparison.
|
# both values down to the second for the comparison.
|
||||||
|
# ctime is used only on == comparaison to always catches Rails 3.1 Assets pipelined on Mac OSX
|
||||||
def file_modified?(path, last_event)
|
def file_modified?(path, last_event)
|
||||||
p path
|
# p path
|
||||||
p @last_event.to_i
|
# p @last_event.to_i
|
||||||
p last_event.to_i
|
# p last_event.to_i
|
||||||
p File.ctime(path).to_i
|
# p File.ctime(path).to_i
|
||||||
p File.mtime(path).to_i
|
# p File.mtime(path).to_i
|
||||||
if File.ctime(path).to_i == last_event.to_i
|
if File.ctime(path).to_i == last_event.to_i
|
||||||
p "File.ctime == last_event"
|
# p "File.ctime == last_event"
|
||||||
res = file_content_modified?(path, sha1_checksum(path))
|
res = file_content_modified?(path, sha1_checksum(path))
|
||||||
p res.to_s
|
# p res.to_s
|
||||||
res
|
res
|
||||||
elsif File.mtime(path).to_i > last_event.to_i
|
elsif File.mtime(path).to_i > last_event.to_i
|
||||||
p "File.ctime > last_event"
|
# p "File.ctime > last_event"
|
||||||
set_sha1_checksums_hash(path, sha1_checksum(path))
|
set_sha1_checksums_hash(path, sha1_checksum(path))
|
||||||
p "true"
|
# p "true"
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
p "false"
|
# p "false"
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
rescue
|
rescue
|
||||||
p "false"
|
# p "false"
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
private
|
private
|
||||||
|
|
||||||
def start
|
def start(rest_delay = @rest_delay)
|
||||||
sleep(@rest_delay || 1)
|
sleep(rest_delay || 1)
|
||||||
@listener.update_last_event
|
@listener.update_last_event
|
||||||
Thread.new { @listener.start }
|
@thread = Thread.new { @listener.start }
|
||||||
sleep(@rest_delay || 1)
|
sleep(rest_delay || 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def record_results
|
def record_results
|
||||||
@ -16,10 +16,11 @@ private
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def stop
|
def stop(rest_delay = @rest_delay)
|
||||||
sleep(@rest_delay || 1)
|
sleep(rest_delay || 1)
|
||||||
@listener.stop
|
@listener.stop
|
||||||
sleep(@rest_delay || 1)
|
Thread.kill(@thread)
|
||||||
|
sleep(rest_delay || 1)
|
||||||
end
|
end
|
||||||
|
|
||||||
def results
|
def results
|
||||||
@ -61,14 +62,14 @@ shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
|
|||||||
results.should =~ ['spec/fixtures/folder1/file1.txt']
|
results.should =~ ['spec/fixtures/folder1/file1.txt']
|
||||||
end
|
end
|
||||||
|
|
||||||
it "catches a single file chmod update" do
|
it "not catches a single file chmod update" do
|
||||||
file = @fixture_path.join("folder1/file1.txt")
|
file = @fixture_path.join("folder1/file1.txt")
|
||||||
File.exists?(file).should be_true
|
File.exists?(file).should be_true
|
||||||
File.chmod(0775, file)
|
File.chmod(0775, file)
|
||||||
start
|
start
|
||||||
File.chmod(0777, file)
|
File.chmod(0777, file)
|
||||||
stop
|
stop
|
||||||
results.should =~ ['spec/fixtures/folder1/file1.txt']
|
results.should =~ []
|
||||||
end
|
end
|
||||||
|
|
||||||
it "catches a dotfile update" do
|
it "catches a dotfile update" do
|
||||||
@ -102,7 +103,7 @@ shared_examples_for 'a listener that reacts to #on_change' do |rest_delay|
|
|||||||
results.should =~ []
|
results.should =~ []
|
||||||
end
|
end
|
||||||
|
|
||||||
it "not catches a moved file", :focus => true do
|
it "not catches a moved file" do
|
||||||
file1 = @fixture_path.join("folder1/file1.txt")
|
file1 = @fixture_path.join("folder1/file1.txt")
|
||||||
file2 = @fixture_path.join("folder1/movedfile1.txt")
|
file2 = @fixture_path.join("folder1/movedfile1.txt")
|
||||||
File.exists?(file1).should be_true
|
File.exists?(file1).should be_true
|
||||||
|
Loading…
Reference in New Issue
Block a user