Class: Fontcustom::Watcher
- Inherits:
-
Object
- Object
- Fontcustom::Watcher
- Includes:
- Utility
- Defined in:
- lib/fontcustom/watcher.rb
Instance Method Summary collapse
-
#initialize(options, is_test = false) ⇒ Watcher
constructor
A new instance of Watcher.
- #watch ⇒ Object
Methods included from Utility
#behavior, #destination_root, #line_break, #methodize_hash, #options, #project_root, #say_changed, #say_message, #say_status, #shell, shell, #source_paths, #symbolize_hash, #write_file
Constructor Details
#initialize(options, is_test = false) ⇒ Watcher
Returns a new instance of Watcher.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/fontcustom/watcher.rb', line 8 def initialize(, is_test = false) @base = Fontcustom::Base.new = @base. @is_test = is_test templates = [:templates].dup.map { |template| File.basename(template) } packaged = %w|preview css scss scss-rails| templates.delete_if { |template| packaged.include?(template) } if templates.empty? @listener = Listen.to([:input][:vectors]) else @listener = Listen.to([:input][:vectors], [:input][:templates]) end @listener = @listener.relative_paths(true) @listener = @listener.filter(/(#{templates.join("|")}|.+\.svg)$/) @listener = @listener.change(&callback) @listener = @listener.(false) if @is_test end |
Instance Method Details
#watch ⇒ Object
29 30 31 32 33 34 |
# File 'lib/fontcustom/watcher.rb', line 29 def watch compile unless [:skip_first] start rescue SignalException # Catches Ctrl + C stop end |