puppetlabs_spec_helper 0.5.2 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGELOG CHANGED
@@ -1,3 +1,17 @@
1
+ 2014-07-02 - Release 0.6.0
2
+ Summary:
3
+ This feature release adds the `validate` rake task and the ability to test
4
+ strict variables and the future parser with rspec-puppet.
5
+
6
+ Features:
7
+ - Add `validate` rake task.
8
+ - Add `STRICT_VARIABLES=yes` to module_spec_helper
9
+ - Add `FUTURE_PARSER=yes` to module_spec_helper
10
+
11
+ Bugfixes:
12
+ - Avoid conflict with Object.clone
13
+ - Install forge fixtures without conflicting with already-installed modules
14
+
1
15
  2014-06-19 - Release 0.5.2
2
16
  Summary:
3
17
  This release removes the previously non-existant puppet runtime dependency to
@@ -94,6 +94,11 @@ NOTE that this is specifically for initializing Puppet's core. If your project
94
94
  not have any dependencies on puppet and you just want to use the utility classes,
95
95
  see the next section.
96
96
 
97
+ To enable strict-variable or future-parser rspec-puppet failures export the
98
+ `STRICT_VARIABLES=yes` and/or `FUTURE_PARSER=yes` environment variables. Eg:
99
+
100
+ FUTURE_PARSER=yes STRICT_VARIABLES=yes rake spec
101
+
97
102
 
98
103
  Using Utility Classes
99
104
  =====================
@@ -21,4 +21,12 @@ module_path = [module_path, env_module_path].join(File::PATH_SEPARATOR) if env_m
21
21
  RSpec.configure do |c|
22
22
  c.module_path = module_path
23
23
  c.manifest_dir = File.join(fixture_path, 'manifests')
24
+ ## These depend on rspec-puppet #209 and #183 being released
25
+ #c.parser = 'future' if ENV['FUTURE_PARSER'] == 'yes'
26
+ #c.strict_variables = true if ENV['STRICT_VARIABLES'] == 'yes'
27
+
28
+ c.before :each do
29
+ Puppet.settings[:strict_variables] = true if ENV['STRICT_VARIABLES'] == 'yes'
30
+ Puppet.settings[:parser] = 'future' if ENV['FUTURE_PARSER'] == 'yes'
31
+ end
24
32
  end
@@ -56,7 +56,7 @@ def fixtures(category)
56
56
  return result
57
57
  end
58
58
 
59
- def clone(scm, remote, target, ref=nil)
59
+ def clone_repo(scm, remote, target, ref=nil)
60
60
  args = []
61
61
  case scm
62
62
  when 'hg'
@@ -96,7 +96,7 @@ task :spec_prep do
96
96
  scm = opts["scm"] if opts["scm"]
97
97
  end
98
98
 
99
- unless File::exists?(target) || clone(scm, remote, target, ref)
99
+ unless File::exists?(target) || clone_repo(scm, remote, target, ref)
100
100
  fail "Failed to clone #{scm} repository #{remote} into #{target}"
101
101
  end
102
102
  revision(scm, target, ref) if ref
@@ -118,6 +118,7 @@ task :spec_prep do
118
118
  next if File::exists?(target)
119
119
  unless system("puppet module install " + ref + \
120
120
  " --ignore-dependencies" \
121
+ " --force" \
121
122
  " --target-dir spec/fixtures/modules #{remote}")
122
123
  fail "Failed to install module #{remote} to #{target}"
123
124
  end
@@ -209,6 +210,19 @@ task :syntax do
209
210
  end
210
211
  end
211
212
 
213
+ desc "Validate manifests, templates, and ruby files in lib."
214
+ task :validate do
215
+ Dir['manifests/**/*.pp'].each do |manifest|
216
+ sh "puppet parser validate --noop #{manifest}"
217
+ end
218
+ Dir['lib/**/*.rb'].each do |lib_file|
219
+ sh "ruby -c #{lib_file}"
220
+ end
221
+ Dir['templates/**/*.erb'].each do |template|
222
+ sh "erb -P -x -T '-' #{template} | ruby -c"
223
+ end
224
+ end
225
+
212
226
  desc "Display the list of available rake tasks"
213
227
  task :help do
214
228
  system("rake -T")
@@ -1,5 +1,5 @@
1
1
  module PuppetlabsSpecHelper
2
2
  module Version
3
- STRING = '0.5.2'
3
+ STRING = '0.6.0'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppetlabs_spec_helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.6.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-19 00:00:00.000000000 Z
12
+ date: 2014-07-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake