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__) + "../../..")
# to speed up boot we use a thread
Thread.new do
["spec", "lib", "app", "config", "test", "vendor", "plugins"].each do |watch|
Listen.to("#{path}/#{watch}", options) do |modified, added, _|
paths = [modified, added].flatten
paths.compact!
paths.map!{|long| long[(path.length+1)..-1]}
process_change(paths)
["spec", "lib", "app", "config", "test", "vendor", "plugins"].each do |watch|
puts "@@@@@@@@@ Listen to #{path}/#{watch} #{options}" if @debug
Thread.new do
begin
Listen.to("#{path}/#{watch}", options) do |modified, added, _|
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