require 'eventmachine'
require 'em-dir-watcher'
EM.kqueue = true if EM.kqueue?
EventMachine.run do
puts 'Watching .'
dw = EMDirWatcher.watch '.',
:include_only => ['*.html'],
:exclude => [],
:grace_period => 0.1 do |paths|
puts paths
end
puts 'Everything goes well so far'
EventMachine::Timer.new(10) do
puts 'Stoping EMDirWatcher. ruby CPU usage is 100% now. WTF?'
dw.stop
end
end