Class: Guard::Processing

Inherits:
Guard
  • Object
show all
Defined in:
lib/guard/processing.rb

Defined Under Namespace

Classes: ProcessController

Instance Method Summary collapse

Constructor Details

#initialize(watchers = [], options = {}) ⇒ Processing



7
8
9
10
11
12
# File 'lib/guard/processing.rb', line 7

def initialize(watchers = [], options = {})
  options = { :pid_dir => 'tmp/pids' }.merge(options)
  FileUtils.makedirs(options[:pid_dir])
  FileUtils.makedirs(options[:output])
  super
end

Instance Method Details

#run_on_changes(paths) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/guard/processing.rb', line 14

def run_on_changes(paths)
  paths.map {|path| Pathname.new(path) }.each do |path|
    dir = path.expand_path.dirname
    process = ProcessController.new(options[:pid_dir], path)
    process.run("processing-java --sketch=#{dir} --output=#{options[:output]} --run --force")
  end
end