lib/fontcustom/watcher.rb in fontcustom-1.0.0 vs lib/fontcustom/watcher.rb in fontcustom-1.0.1
- old
+ new
@@ -3,21 +3,23 @@
module Fontcustom
class Watcher
def initialize(opts)
@opts = opts
- @listener = Listen.to(@opts[:input])
- .relative_paths(true)
- .filter(/\.(eps|svg)$/)
- .change(&callback)
+ @listener = Listen.to(@opts[:input]).relative_paths(true).filter(/\.(eps|svg)$/).change(&callback)
@opts[:blocking] = @opts[:blocking] == false ? false : true
@listener = @listener.polling_fallback_message(false) unless @opts[:blocking]
end
def watch
puts "Font Custom is watching your icons at #{@opts[:input]}. Press Ctrl + C to stop."
compile unless @opts[:skip_first]
- @listener.start @opts[:blocking]
+
+ if @opts[:blocking]
+ @listener.start!
+ else
+ @listener.start
+ end
rescue Fontcustom::Error => e
show_error e
# Catches Ctrl + C