Sha256: 541655d3ca07bef90e532f02164052e8519e2a11a890f432cd4fa3018d585459

Contents?: true

Size: 807 Bytes

Versions: 5

Compression:

Stored size: 807 Bytes

Contents

module Svgeez
  module Commands
    class Watch < Command
      class << self
        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

        private

        def command_action(options)
          Build.process(options)
          Watch.process(options)
        end

        def command_description
          'Watches a folder of SVG icons for changes'
        end

        def command_syntax
          'watch [options]'
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
svgeez-4.1.0 lib/svgeez/commands/watch.rb
svgeez-4.0.0 lib/svgeez/commands/watch.rb
svgeez-3.2.0 lib/svgeez/commands/watch.rb
svgeez-3.1.0 lib/svgeez/commands/watch.rb
svgeez-3.0.0 lib/svgeez/commands/watch.rb