guard-puppet 0.0.2 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6a6aa836468627ae093cc9fb22ad8090427b9a74
4
+ data.tar.gz: 78abc5d1a94331a205bfda80132cdc8ce88eafc6
5
+ SHA512:
6
+ metadata.gz: 880a53421e56161690f2fd5290c626e7815bbab3115dc1ea79c4d9078f420cec7372f3ade6d657789b754d8fbce0d07aa681b6bb872c6e793e7cc0951c1f29d8
7
+ data.tar.gz: 28698c09a3efa6aaa0a3cfa4e813e16f6828d6c0213011b186aac04e1db50ba3dc7e873e53c0f76d70d8c4c8fbdb4cc3cbf2c1277f5c8e005b913234306927f7
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/Gemfile CHANGED
@@ -1,9 +1,23 @@
1
1
  source "http://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in guard-puppet.gemspec
4
- gemspec
4
+ gemspec development_group: :gem_build_tools
5
5
 
6
- require 'rbconfig'
7
- if RbConfig::CONFIG['host_os'] =~ /linux/
8
- gem 'libnotify'
6
+ group :development do
7
+ gem 'guard', '~> 2.12'
8
+ gem 'guard-rspec', '~> 4.5'
9
+
10
+ require 'rbconfig'
11
+ if RbConfig::CONFIG['host_os'] =~ /linux/
12
+ gem 'libnotify'
13
+ end
14
+ end
15
+
16
+ group :test do
17
+ gem 'rspec', '~> 2.99'
18
+ gem 'mocha'
19
+ end
20
+
21
+ group :gem_build_tools do
22
+ gem 'rake'
9
23
  end
data/Guardfile CHANGED
@@ -1,9 +1,28 @@
1
1
  # A sample Guardfile
2
2
  # More info at https://github.com/guard/guard#readme
3
3
 
4
- guard 'rspec', :version => 2 do
5
- watch(%r{^spec/.+_spec\.rb$})
6
- watch(%r{^lib/(.+)\.rb$}) { |m| "spec/lib/#{m[1]}_spec.rb" }
7
- watch('spec/spec_helper.rb') { "spec" }
8
- end
4
+ # Note: The cmd option is now required due to the increasing number of ways
5
+ # rspec may be run, below are examples of the most common uses.
6
+ # * bundler: 'bundle exec rspec'
7
+ # * bundler binstubs: 'bin/rspec'
8
+ # * spring: 'bin/rspec' (This will use spring if running and you have
9
+ # installed the spring binstubs per the docs)
10
+ # * zeus: 'zeus rspec' (requires the server to be started separately)
11
+ # * 'just' rspec: 'rspec'
12
+
13
+ guard :rspec, cmd: "bundle exec rspec" do
14
+ require "guard/rspec/dsl"
15
+ dsl = Guard::RSpec::Dsl.new(self)
16
+
17
+ # Feel free to open issues for suggestions and improvements
9
18
 
19
+ # RSpec files
20
+ rspec = dsl.rspec
21
+ watch(rspec.spec_helper) { rspec.spec_dir }
22
+ watch(rspec.spec_support) { rspec.spec_dir }
23
+ watch(rspec.spec_files)
24
+
25
+ # Ruby files
26
+ ruby = dsl.ruby
27
+ dsl.watch_spec_files_for(ruby.lib_files)
28
+ end
data/README.md CHANGED
@@ -10,8 +10,9 @@ It's assumed your configs are all in the current folder, which is the
10
10
  equivalent of `--confdir=$PWD` at the command line. Otherwise,
11
11
  there's not much use of using Guard with Puppet. :)
12
12
 
13
- Three options so far:
13
+ Four options so far:
14
14
 
15
+ * `:run_on_start`: Apply Puppet configs when starting Guard (default: `false`)
15
16
  * `:verbose`: Show more output from Puppet (default: `true`)
16
17
  * `:debug`: Show even more output from Puppet (default: `false`)
17
18
  * `:manifest`: The main manifest file to run (default: `manifests/site.pp`)
data/Rakefile CHANGED
@@ -1 +1,9 @@
1
+ include Rake::DSL if defined?(Rake::DSL)
2
+
1
3
  require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task :default => 'spec'
9
+
@@ -7,20 +7,16 @@ Gem::Specification.new do |s|
7
7
  s.version = Guard::PuppetVersion::VERSION
8
8
  s.authors = ["John Bintz"]
9
9
  s.email = ["john@coswellproductions.com"]
10
- s.homepage = ""
10
+ s.license = "MIT"
11
+ s.homepage = "https://github.com/guard/guard-puppet"
11
12
  s.summary = %q{Reapply Puppet configs automatically using Guard.}
12
- s.description = %q{Reapply Puppet configs automatically using Guard.}
13
-
14
- s.rubyforge_project = "guard-puppet"
13
+ s.description = %q{Guard plugin to reapply Puppet configurations.}
15
14
 
16
15
  s.files = `git ls-files`.split("\n")
17
16
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
17
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
18
  s.require_paths = ["lib"]
20
19
 
21
- s.add_dependency 'guard'
22
- s.add_dependency 'puppet'
23
-
24
- s.add_development_dependency 'rspec', '~> 2.6.0'
25
- s.add_development_dependency 'mocha'
20
+ s.add_dependency 'guard-compat', '~> 1.2'
21
+ s.add_dependency 'puppet', '~> 4.1'
26
22
  end
@@ -1,16 +1,17 @@
1
- require 'guard/guard'
1
+ require 'guard/compat/plugin'
2
2
 
3
- module ::Guard
4
- class Puppet < ::Guard::Guard
3
+ module Guard
4
+ class Puppet < Plugin
5
5
  class << self
6
6
  attr_accessor :is_wrapping_exit
7
7
  end
8
8
 
9
- def initialize(watchers = [], options = {})
9
+ def initialize(options = {})
10
10
  super
11
11
  @options = options
12
12
 
13
13
  UI.info "Guard::Puppet is watching for changes..."
14
+ run_all if options[:run_on_start]
14
15
  end
15
16
 
16
17
  def run_all
@@ -21,6 +21,12 @@ module Guard
21
21
 
22
22
  begin
23
23
  maybe_bundle_with_env do
24
+ # TODO: hack, untested, needed to avoid:
25
+ #
26
+ #"Error: Could not initialize global default settings:
27
+ # Attempting to initialize global default settings more than once!"
28
+ ::Puppet.settings.send(:clear_everything_for_tests)
29
+
24
30
  ::Puppet::Util::CommandLine.new('puppet', command_line_params).execute
25
31
  end
26
32
  0
@@ -50,7 +56,7 @@ module Guard
50
56
  private
51
57
  def maybe_bundle_with_env(&block)
52
58
  if defined?(::Bundler)
53
- Bundler.with_clean_env(&block)
59
+ ::Bundler.with_clean_env(&block)
54
60
  else
55
61
  yield
56
62
  end
@@ -1,5 +1,5 @@
1
1
  module Guard
2
2
  module PuppetVersion
3
- VERSION = '0.0.2'
3
+ VERSION = '1.0.0'
4
4
  end
5
5
  end
@@ -32,11 +32,11 @@ describe Guard::Puppet::Runner do
32
32
  end
33
33
 
34
34
  describe '#run' do
35
- before do
36
- ::Puppet::Util::CommandLine.expects(:new).raises(SystemExit.new(return_value))
37
- end
38
-
39
35
  context 'returns a non-zero value' do
36
+ before do
37
+ ::Puppet::Util::CommandLine.expects(:new).raises(SystemExit.new(return_value))
38
+ end
39
+
40
40
  let(:return_value) { 10 }
41
41
 
42
42
  it 'should return the result of an exit call' do
@@ -44,6 +44,27 @@ describe Guard::Puppet::Runner do
44
44
  end
45
45
  end
46
46
 
47
+ context 'when bundler is used' do
48
+ before do
49
+ module ::Guard
50
+ class Bundler
51
+ def self.with_clean_env
52
+ fail "Called with_clean_env on Guard::Bundler instead of Bundler"
53
+ end
54
+ end
55
+ end
56
+ end
57
+
58
+ it 'uses a clean env' do
59
+ ran = false
60
+ ::Bundler.stubs(:with_clean_env).with() do
61
+ ran = true
62
+ end
63
+ runner.run
64
+ ran.should == true
65
+ end
66
+ end
67
+
47
68
  context 'returns a zero value' do
48
69
  let(:return_value) { 0 }
49
70
  let(:messages) do
@@ -1,9 +1,30 @@
1
1
  require 'spec_helper'
2
+ require 'guard/compat/test/helper'
2
3
  require 'guard/puppet'
3
4
 
4
5
  describe Guard::Puppet do
5
6
  let(:guard) { described_class.new }
6
7
 
8
+ describe '#initialize' do
9
+ before do
10
+ Guard::UI.stubs(:info)
11
+ end
12
+
13
+ context 'without :run_on_start' do
14
+ it 'should not run anything' do
15
+ described_class.new
16
+ end
17
+ end
18
+
19
+ context 'with :run_on_start' do
20
+ it 'should run Puppet on start' do
21
+ Guard::Puppet.any_instance.expects(:run_all)
22
+
23
+ described_class.new(:run_on_start => true)
24
+ end
25
+ end
26
+ end
27
+
7
28
  describe '#run_all' do
8
29
  before do
9
30
  Guard::UI.stubs(:info)
metadata CHANGED
@@ -1,73 +1,52 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: guard-puppet
3
- version: !ruby/object:Gem::Version
4
- prerelease:
5
- version: 0.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
6
5
  platform: ruby
7
- authors:
6
+ authors:
8
7
  - John Bintz
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
-
13
- date: 2011-07-06 00:00:00 -04:00
14
- default_executable:
15
- dependencies:
16
- - !ruby/object:Gem::Dependency
17
- name: guard
18
- prerelease: false
19
- requirement: &id001 !ruby/object:Gem::Requirement
20
- none: false
21
- requirements:
22
- - - ">="
23
- - !ruby/object:Gem::Version
24
- version: "0"
11
+ date: 2015-06-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: guard-compat
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.2'
25
20
  type: :runtime
26
- version_requirements: *id001
27
- - !ruby/object:Gem::Dependency
28
- name: puppet
29
21
  prerelease: false
30
- requirement: &id002 !ruby/object:Gem::Requirement
31
- none: false
32
- requirements:
33
- - - ">="
34
- - !ruby/object:Gem::Version
35
- version: "0"
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: puppet
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '4.1'
36
34
  type: :runtime
37
- version_requirements: *id002
38
- - !ruby/object:Gem::Dependency
39
- name: rspec
40
- prerelease: false
41
- requirement: &id003 !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ~>
45
- - !ruby/object:Gem::Version
46
- version: 2.6.0
47
- type: :development
48
- version_requirements: *id003
49
- - !ruby/object:Gem::Dependency
50
- name: mocha
51
35
  prerelease: false
52
- requirement: &id004 !ruby/object:Gem::Requirement
53
- none: false
54
- requirements:
55
- - - ">="
56
- - !ruby/object:Gem::Version
57
- version: "0"
58
- type: :development
59
- version_requirements: *id004
60
- description: Reapply Puppet configs automatically using Guard.
61
- email:
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '4.1'
41
+ description: Guard plugin to reapply Puppet configurations.
42
+ email:
62
43
  - john@coswellproductions.com
63
44
  executables: []
64
-
65
45
  extensions: []
66
-
67
46
  extra_rdoc_files: []
68
-
69
- files:
70
- - .gitignore
47
+ files:
48
+ - ".gitignore"
49
+ - ".rspec"
71
50
  - Gemfile
72
51
  - Guardfile
73
52
  - README.md
@@ -82,36 +61,28 @@ files:
82
61
  - spec/lib/guard/puppet/runner_spec.rb
83
62
  - spec/lib/guard/puppet_spec.rb
84
63
  - spec/spec_helper.rb
85
- has_rdoc: true
86
- homepage: ""
87
- licenses: []
88
-
64
+ homepage: https://github.com/guard/guard-puppet
65
+ licenses:
66
+ - MIT
67
+ metadata: {}
89
68
  post_install_message:
90
69
  rdoc_options: []
91
-
92
- require_paths:
70
+ require_paths:
93
71
  - lib
94
- required_ruby_version: !ruby/object:Gem::Requirement
95
- none: false
96
- requirements:
72
+ required_ruby_version: !ruby/object:Gem::Requirement
73
+ requirements:
97
74
  - - ">="
98
- - !ruby/object:Gem::Version
99
- version: "0"
100
- required_rubygems_version: !ruby/object:Gem::Requirement
101
- none: false
102
- requirements:
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ required_rubygems_version: !ruby/object:Gem::Requirement
78
+ requirements:
103
79
  - - ">="
104
- - !ruby/object:Gem::Version
105
- version: "0"
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
106
82
  requirements: []
107
-
108
- rubyforge_project: guard-puppet
109
- rubygems_version: 1.6.2
83
+ rubyforge_project:
84
+ rubygems_version: 2.4.7
110
85
  signing_key:
111
- specification_version: 3
86
+ specification_version: 4
112
87
  summary: Reapply Puppet configs automatically using Guard.
113
- test_files:
114
- - spec/lib/guard/puppet/log_spec.rb
115
- - spec/lib/guard/puppet/runner_spec.rb
116
- - spec/lib/guard/puppet_spec.rb
117
- - spec/spec_helper.rb
88
+ test_files: []