run on start

This commit is contained in:
John Bintz 2011-07-06 19:29:43 -04:00
parent f8ea9eec9d
commit 940698d431
4 changed files with 33 additions and 1 deletions

View File

@ -10,8 +10,9 @@ It's assumed your configs are all in the current folder, which is the
equivalent of `--confdir=$PWD` at the command line. Otherwise,
there's not much use of using Guard with Puppet. :)
Three options so far:
Four options so far:
* `:run_on_start`: Apply Puppet configs when starting Guard (default: `false`)
* `:verbose`: Show more output from Puppet (default: `true`)
* `:debug`: Show even more output from Puppet (default: `false`)
* `:manifest`: The main manifest file to run (default: `manifests/site.pp`)

View File

@ -1 +1,9 @@
include Rake::DSL if defined?(Rake::DSL)
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
task :default => 'spec'

View File

@ -11,6 +11,7 @@ module ::Guard
@options = options
UI.info "Guard::Puppet is watching for changes..."
run_all if options[:run_on_start]
end
def run_all

View File

@ -1,9 +1,31 @@
require 'spec_helper'
require 'guard/puppet'
require 'guard/ui'
require 'guard/notifier'
describe Guard::Puppet do
let(:guard) { described_class.new }
describe '#initialize' do
before do
Guard::UI.stubs(:info)
end
context 'without :run_on_start' do
it 'should not run anything' do
described_class.new
end
end
context 'with :run_on_start' do
it 'should run Puppet on start' do
Guard::Puppet.any_instance.expects(:run_all)
described_class.new([], { :run_on_start => true })
end
end
end
describe '#run_all' do
before do
Guard::UI.stubs(:info)