2012-03-14 23:54:34 +00:00
|
|
|
require 'guard'
|
|
|
|
require 'guard/guard'
|
|
|
|
|
|
|
|
require 'flowerbox'
|
|
|
|
|
|
|
|
module Guard
|
|
|
|
class Flowerbox < Guard
|
|
|
|
def initialize(watchers = [], options = {})
|
|
|
|
@options = options
|
|
|
|
|
|
|
|
super
|
|
|
|
end
|
|
|
|
|
|
|
|
def start
|
|
|
|
UI.info "Guard::Flowerbox running in #{@options[:dir]}"
|
|
|
|
end
|
|
|
|
|
2012-03-15 18:21:45 +00:00
|
|
|
def stop
|
|
|
|
UI.info "Stopping Guard::Flowerbox..."
|
|
|
|
|
|
|
|
::Flowerbox.cleanup!
|
|
|
|
end
|
|
|
|
|
2012-03-14 23:54:34 +00:00
|
|
|
def run_all
|
|
|
|
UI.info "Guard::Flowerbox running all files..."
|
|
|
|
::Flowerbox.run(@options[:dir], @options)
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_on_change(files = [])
|
2012-03-22 13:21:12 +00:00
|
|
|
files = files.dup.uniq
|
|
|
|
|
2012-03-14 23:54:34 +00:00
|
|
|
UI.info "Guard::Flowerbox running the following files: #{files.join(', ')}"
|
|
|
|
|
2012-03-17 15:08:45 +00:00
|
|
|
if ::Flowerbox.run(@options[:dir], @options.dup.merge(:files => files)) == 0
|
|
|
|
run_all
|
|
|
|
end
|
2012-03-14 23:54:34 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|