Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix example due to changed EMDirWatcher.watch API
  • Loading branch information
dottedmag committed Aug 8, 2010
1 parent 318ac21 commit a2c445b
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions examples/monitor.rb
Expand Up @@ -9,18 +9,21 @@
exclusions = ARGV.select { |arg| arg =~ /^!/ }.collect { |arg| arg[1..-1] }

EM.error_handler{ |e|
puts "Error raised during event loop: #{e.class.name} #{e.message}"
puts e.backtrace
puts "Error raised during event loop: #{e.class.name} #{e.message}"
puts e.backtrace
}

EM.run {
dw = EMDirWatcher.watch dir, :include_only => inclusions, :exclude => exclusions do |path|
full_path = File.join(dir, path)
if File.exists? full_path
puts "Modified: #{path}"
else
puts "Deleted: #{path}"
end
dw = EMDirWatcher.watch dir, :include_only => inclusions, :exclude => exclusions do |paths|
paths.each do |path|
puts path
full_path = File.join(dir, path)
if File.exists? full_path
puts "Modified: #{path}"
else
puts "Deleted: #{path}"
end
end
puts "Monitoring #{File.expand_path(dir)}..."
end
puts "Monitoring #{File.expand_path(dir)}..."
}

0 comments on commit a2c445b

Please sign in to comment.