[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, experimental, updated. debian/2.6.8-1-844-g7ec39d5

Daniel Pittman daniel at puppetlabs.com
Tue May 10 08:18:32 UTC 2011


The following commit has been merged in the experimental branch:
commit 0256d67e1a51a37f2c87ec197bdff6ef3a6b269f
Author: Daniel Pittman <daniel at puppetlabs.com>
Date:   Wed Apr 27 10:38:41 2011 -0700

    (#6962) Add integration tests on Face documentation.
    
    We now run all the faces, and their actions, as well as global help through
    the wringer in this test: this way we can be confident that we have, at least,
    the ability to generate the help without a user-visible failure.
    
    We also check that we have set copyright and license terms in our own faces.
    Theoretically this might fail if the end user has extra faces on LOAD_PATH,
    but my hope is that we won't hit that...

diff --git a/lib/puppet/interface/option.rb b/lib/puppet/interface/option.rb
index 493b5c3..b68bdeb 100644
--- a/lib/puppet/interface/option.rb
+++ b/lib/puppet/interface/option.rb
@@ -1,7 +1,7 @@
 require 'puppet/interface'
 
 class Puppet::Interface::Option
-  include Puppet::Interface::FullDocs
+  include Puppet::Interface::TinyDocs
   # For compatibility, deprecated, and should go fairly soon...
   ['', '='].each { |x| alias :"desc#{x}" :"description#{x}" }
 
diff --git a/spec/integration/faces/documentation_spec.rb b/spec/integration/faces/documentation_spec.rb
new file mode 100755
index 0000000..9ddf2f1
--- /dev/null
+++ b/spec/integration/faces/documentation_spec.rb
@@ -0,0 +1,55 @@
+#!/usr/bin/env rspec
+require 'spec_helper'
+require 'puppet/face'
+
+describe "documentation of faces" do
+  it "should generate global help" do
+    help = nil
+    expect { help = Puppet::Face[:help, :current].help }.not_to raise_error
+    help.should be_an_instance_of String
+    help.length.should be > 200
+  end
+
+  ########################################################################
+  # Can we actually generate documentation for the face, and the actions it
+  # has?  This avoids situations where the ERB template turns out to have a
+  # bug in it, triggered in something the user might do.
+  Puppet::Face.faces.sort.each do |face_name|
+    # REVISIT: We should walk all versions of the face here...
+    let :help do Puppet::Face[:help, :current] end
+
+    context "generating help" do
+      it "for #{face_name}" do
+        expect {
+          text = help.help(face_name)
+          text.should be_an_instance_of String
+          text.length.should be > 100
+        }.not_to raise_error
+      end
+
+      Puppet::Face[face_name, :current].actions.sort.each do |action_name|
+        it "for #{face_name}.#{action_name}" do
+          expect {
+            text = help.help(face_name, action_name)
+            text.should be_an_instance_of String
+            text.length.should be > 100
+          }.not_to raise_error
+        end
+      end
+    end
+
+    ########################################################################
+    # Ensure that we have authorship and copyright information in *our* faces;
+    # if you apply this to third party faces you might well be disappointed.
+    context "licensing of Puppet Labs face '#{face_name}'" do
+      subject { Puppet::Face[face_name, :current] }
+      its :license   do should =~ /Apache\s*2/ end
+      its :copyright do should =~ /Puppet Labs/ end
+
+      # REVISIT: This is less that ideal, I think, but right now I am more
+      # comfortable watching us ship with some copyright than without any; we
+      # can redress that when it becomes appropriate. --daniel 2011-04-27
+      its :copyright do should =~ /2011/ end
+    end
+  end
+end
diff --git a/spec/lib/puppet/face/basetest.rb b/spec/lib/puppet/face/basetest.rb
index a98bc38..41a4ef3 100755
--- a/spec/lib/puppet/face/basetest.rb
+++ b/spec/lib/puppet/face/basetest.rb
@@ -1,6 +1,8 @@
 require 'puppet/face'
 
 Puppet::Face.define(:basetest, '0.0.1') do
+  copyright "Puppet Labs", 2011
+  license   "Apache 2 license; see COPYING"
   summary "This is just so tests don't fail"
 
   option "--[no-]boolean"
diff --git a/spec/lib/puppet/face/huzzah.rb b/spec/lib/puppet/face/huzzah.rb
index 3428c68..2c2b7aa 100755
--- a/spec/lib/puppet/face/huzzah.rb
+++ b/spec/lib/puppet/face/huzzah.rb
@@ -1,5 +1,7 @@
 require 'puppet/face'
 Puppet::Face.define(:huzzah, '2.0.1') do
+  copyright "Puppet Labs", 2011
+  license   "Apache 2 license; see COPYING"
   summary "life is a thing for celebration"
   action :bar do "is where beer comes from" end
 end
diff --git a/spec/lib/puppet/face/version_matching.rb b/spec/lib/puppet/face/version_matching.rb
index bfd0013..52bc71d 100644
--- a/spec/lib/puppet/face/version_matching.rb
+++ b/spec/lib/puppet/face/version_matching.rb
@@ -4,6 +4,8 @@ require 'puppet/face'
 # change this you need to ensure that is still correct. --daniel 2011-04-21
 ['1.0.0', '1.0.1', '1.1.0', '1.1.1', '2.0.0'].each do |version|
   Puppet::Face.define(:version_matching, version) do
+    copyright "Puppet Labs", 2011
+    license   "Apache 2 license; see COPYING"
     summary "version matching face #{version}"
     script :version do version end
   end

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list