Class: Js2coffee::Watcher
- Inherits:
-
Object
- Object
- Js2coffee::Watcher
- Includes:
- Singleton
- Defined in:
- lib/js2coffee/watcher.rb
Instance Method Summary collapse
-
#initialize ⇒ Watcher
constructor
A new instance of Watcher.
Constructor Details
#initialize ⇒ Watcher
Returns a new instance of Watcher.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/js2coffee/watcher.rb', line 11 def initialize @notifier = INotify::Notifier.new Signal.trap(2) {|_sig| Process.exit } start_watch_files @notifier.watch('.', :moved_from, :moved_to, :create, :delete, :onlydir, :recursive) do |event| # skip temp file. next if event.name =~ /^\.#|^#.*\#$/ start_watch_files end watched_files.each do |file| Js2coffee.watch_file(file) end # start loop. @notifier.run puts 'Watcher is started.' end |