class Voog::Dtk::Watcher
Public Class Methods
new(filemanager, debug=false)
click to toggle source
# File lib/voog/dtk/watcher.rb, line 37 def initialize(filemanager, debug=false) paths = ['layouts/', 'components/', 'assets/', 'javascripts/', 'stylesheets/', 'images/'] @filemanager = filemanager @debug = debug @listener = Listen.to(*paths) do |modified, added, removed| handle_added added unless added.empty? handle_removed removed unless removed.empty? handle_modified modified unless modified.empty? end end
Public Instance Methods
handle_added(added)
click to toggle source
# File lib/voog/dtk/watcher.rb, line 49 def handle_added(added) @filemanager.add_files added rescue => e @filemanager.notifier.newline Voog::Dtk.handle_exception e, @debug, @filemanager.notifier end
handle_modified(modified)
click to toggle source
# File lib/voog/dtk/watcher.rb, line 63 def handle_modified(modified) @filemanager.upload_files modified rescue => e @filemanager.notifier.newline Voog::Dtk.handle_exception e, @debug, @filemanager.notifier end
handle_removed(removed)
click to toggle source
# File lib/voog/dtk/watcher.rb, line 56 def handle_removed(removed) @filemanager.remove_files removed rescue => e @filemanager.notifier.newline Voog::Dtk.handle_exception e, @debug, @filemanager.notifier end
run()
click to toggle source
# File lib/voog/dtk/watcher.rb, line 70 def run @listener.start sleep end