Permalink
Browse files

run on start

  • Loading branch information...
1 parent f8ea9ee commit 940698d4316c75d661798021ef490a3670183b3f @johnbintz committed Jul 6, 2011
Showing with 33 additions and 1 deletion.
  1. +2 −1 README.md
  2. +8 −0 Rakefile
  3. +1 −0 lib/guard/puppet.rb
  4. +22 −0 spec/lib/guard/puppet_spec.rb
View
@@ -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
@@ -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
@@ -11,6 +11,7 @@ def initialize(watchers = [], options = {})
@options = options
UI.info "Guard::Puppet is watching for changes..."
+ run_all if options[:run_on_start]
end
def run_all
@@ -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)

0 comments on commit 940698d

Please sign in to comment.