compass/lib/vendor/fssm/backends/fsevents.rb

37 lines
678 B
Ruby
Raw Normal View History

2009-09-03 05:42:59 +00:00
require 'fssm/fsevents'
module FSSM::Backends
2009-09-03 05:42:59 +00:00
class FSEvents
def initialize
@handlers = {}
@fsevents = []
end
def add_path(path, preload=true)
2009-09-03 05:42:59 +00:00
handler = FSSM::State.new(path, preload)
@handlers["#{path}"] = handler
2009-09-03 05:42:59 +00:00
fsevent = Rucola::FSEvents.new("#{path}") do |events|
events.each do |event|
handler.refresh(event.path)
end
end
2009-09-03 05:42:59 +00:00
fsevent.create_stream
fsevent.start
@fsevents << fsevent
end
def run
begin
OSX.CFRunLoopRun
rescue Interrupt
2009-09-03 05:42:59 +00:00
@fsevents.each do |fsev|
fsev.stop
end
end
end
2009-09-03 05:42:59 +00:00
end
end