guard-puppet/lib/guard/puppet.rb
2011-07-05 19:43:36 -04:00

34 lines
817 B
Ruby

require 'guard/guard'
module ::Guard
class Puppet < ::Guard::Guard
class << self
attr_accessor :is_wrapping_exit
end
def initialize(watchers = [], options = {})
super
@options = options
UI.info "Guard::Puppet is watching for changes..."
end
def run_all
UI.info(msg = "Applying Puppet configuration...")
Notifier.notify msg, :title => "Puppet Config", :image => :pending
if Runner.new(@options).run != 0
Notifier.notify(msg = "Puppet config failure!", :title => "Puppet Config", :image => :failed)
else
Notifier.notify(msg = "Puppet config reapplied successfully!", :title => "Puppet Config")
end
UI.info(msg)
end
def run_on_change(files = [])
run_all
end
end
end
require 'guard/puppet/runner'