Class: Svgeez::Commands::Watch

Inherits:
Svgeez::Command show all
Defined in:
lib/svgeez/commands/watch.rb

Class Method Summary collapse

Methods inherited from Svgeez::Command

inherited, init_with_program, subclasses

Class Method Details

.process(options) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/svgeez/commands/watch.rb', line 5

def process(options)
  builder = Svgeez::Builder.new(options)
  folder_path = builder.source.folder_path

  Svgeez.logger.info "Watching `#{folder_path}` for changes... Press ctrl-c to stop."

  Listen.to(folder_path, only: /\.svg\z/) { builder.build }.start
  sleep
rescue Interrupt
  Svgeez.logger.info 'Quitting svgeez...'
end