FIX: autospec not monitoring correctly

This commit is contained in:
Sam 2015-12-17 13:17:24 +11:00
parent e53f110c83
commit 29f6d960c6

View file

@ -159,13 +159,20 @@ class Autospec::Manager
path = File.expand_path(File.dirname(__FILE__) + "../../..") path = File.expand_path(File.dirname(__FILE__) + "../../..")
# to speed up boot we use a thread # to speed up boot we use a thread
Thread.new do ["spec", "lib", "app", "config", "test", "vendor", "plugins"].each do |watch|
["spec", "lib", "app", "config", "test", "vendor", "plugins"].each do |watch|
Listen.to("#{path}/#{watch}", options) do |modified, added, _| puts "@@@@@@@@@ Listen to #{path}/#{watch} #{options}" if @debug
paths = [modified, added].flatten Thread.new do
paths.compact! begin
paths.map!{|long| long[(path.length+1)..-1]} Listen.to("#{path}/#{watch}", options) do |modified, added, _|
process_change(paths) paths = [modified, added].flatten
paths.compact!
paths.map!{|long| long[(path.length+1)..-1]}
process_change(paths)
end
rescue => e
puts "FAILED to listen on changes to #{path}/#{watch}"
puts e
end end
end end
end end