compass/lib/vendor/fssm/backends/fsevents.rb
2009-09-02 22:42:59 -07:00

37 lines
678 B
Ruby

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