Please review pull request #739: Add RSpec exclusion option to "module generate" opened by (zenchild)
Description:
This is basically a feature request for the 'generate' method. I prefer to use the boilerplate from rspec-puppet so I've added the following option:
Add option to exclude RSpec tests (-x).
Let me know if this looks OK. If you prefer not to merge it no sweat... :)
Cheers,
Dan Wanek
- Opened: Thu May 03 21:27:02 UTC 2012
- Based on: puppetlabs:master (c9386b541e9ecf6c0daffde2825bad385ea4da2b)
- Requested merge: zenchild:master (b151189072a7d40c28e7fb85910535e3b52f6579)
Diff follows:
diff --git a/lib/puppet/face/module/generate.rb b/lib/puppet/face/module/generate.rb
index a30a2ff..2390f3d 100644
--- a/lib/puppet/face/module/generate.rb
+++ b/lib/puppet/face/module/generate.rb
@@ -31,6 +31,15 @@
arguments "<name>"
+ option "--exclude_spec", "-x" do
+ summary "Exclude RSpec test boilerplate."
+ description <<-EOT
+ Exclude the RSpec boilerplate code. This is handy if you are writing your
+ own tests or if you want to generate the boilerplate with the rspec-puppet
+ tool itself.
+ EOT
+ end
+
when_invoked do |name, options|
Puppet::ModuleTool.set_option_defaults options
Puppet::ModuleTool::Applications::Generator.run(name, options)
diff --git a/lib/puppet/module_tool/applications/generator.rb b/lib/puppet/module_tool/applications/generator.rb
index 9e26805..5f0add7 100644
--- a/lib/puppet/module_tool/applications/generator.rb
+++ b/lib/puppet/module_tool/applications/generator.rb
@@ -33,6 +33,7 @@ def run
if path == skeleton
destination.mkpath
else
+ next if (path.fnmatch?('*/spec*') && @options[:exclude_spec])
node = Node.on(path, self)
if node
node.install!
-- You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
