class Pristine::Daemon

Public Class Methods

notifier() click to toggle source
# File lib/pristine/daemon.rb, line 8
def self.notifier
  @@notifier ||= INotify::Notifier.new
  @@notifier
end
run() click to toggle source
# File lib/pristine/daemon.rb, line 27
def self.run
  set_target_files(Config.files_list)
  notifier.run
rescue Interrupt
  notifier.stop
  Log.info 'Stopped all watchers. Exiting.'
end
set_target_files(files) click to toggle source
# File lib/pristine/daemon.rb, line 13
def self.set_target_files(files)
  files.each do |file|
    begin
      notifier.watch(file, Config.flags) do |event|
        Collector.add_event(event.absolute_name, event.flags)
      end
      Log.info "#{file} watcher created."
    rescue
      Log.warn "#{file} does not exist."
    end
  end
  notifier
end