2010-10-03 21:00:33 +00:00
|
|
|
module Guard
|
|
|
|
class Guard
|
|
|
|
attr_accessor :watchers, :options
|
|
|
|
|
|
|
|
def initialize(watchers = [], options = {})
|
|
|
|
@watchers, @options = watchers, options
|
|
|
|
end
|
|
|
|
|
2010-10-07 20:37:30 +00:00
|
|
|
# Guardfile template needed inside guard gem
|
|
|
|
def self.init(name)
|
|
|
|
if ::Guard::Dsl.guardfile_included?(name)
|
|
|
|
::Guard::UI.info "Guardfile already include #{name} guard"
|
|
|
|
else
|
|
|
|
content = File.read('Guardfile')
|
|
|
|
guard = File.read("#{::Guard.locate_guard(name)}/lib/guard/#{name}/templates/Guardfile")
|
|
|
|
File.open('Guardfile', 'wb') do |f|
|
|
|
|
f.puts content
|
|
|
|
f.puts ""
|
|
|
|
f.puts guard
|
|
|
|
end
|
|
|
|
::Guard::UI.info "#{name} guard added to Guardfile, feel free to edit it"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2010-10-03 21:00:33 +00:00
|
|
|
# ================
|
|
|
|
# = Guard method =
|
|
|
|
# ================
|
|
|
|
|
|
|
|
def start
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
2010-10-26 17:28:49 +00:00
|
|
|
# Retrieve a true value if the instance successfuly stopped
|
2010-10-03 21:00:33 +00:00
|
|
|
def stop
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def reload
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_all
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
def run_on_change(paths)
|
|
|
|
true
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|