[Pkg-puppet-devel] [SCM] Puppet packaging for Debian branch, upstream, updated. 0.25.5-639-g8f94f35

Brice Figureau brice-puppet at daysofwonder.com
Wed Jul 14 10:29:28 UTC 2010


The following commit has been merged in the upstream branch:
commit b832d815c3211f22945cbce56dfbf61116f7a792
Author: Brice Figureau <brice-puppet at daysofwonder.com>
Date:   Wed Nov 4 20:21:16 2009 +0100

    Fix #2784 - puppetdoc/rdoc didn't parse mono-instruction class content
    
    class klass {
      include a, b, c
    }
    
    wasn't producing any rdoc documentation.
    We were thinking code was always embedded in an array which is not
    the case for mono-instruction code.
    
    Signed-off-by: Brice Figureau <brice-puppet at daysofwonder.com>

diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb
index aa34335..d7e1c30 100644
--- a/lib/puppet/util/rdoc/parser.rb
+++ b/lib/puppet/util/rdoc/parser.rb
@@ -148,6 +148,7 @@ class Parser
     # create documentation for include statements we can find in +code+
     # and associate it with +container+
     def scan_for_include_or_require(container, code)
+        code = [code] unless code.is_a?(Array)
         code.each do |stmt|
             scan_for_include_or_require(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 
@@ -163,6 +164,7 @@ class Parser
     # create documentation for global variables assignements we can find in +code+
     # and associate it with +container+
     def scan_for_vardef(container, code)
+        code = [code] unless code.is_a?(Array)
         code.each do |stmt|
             scan_for_vardef(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 
@@ -176,6 +178,7 @@ class Parser
     # create documentation for resources we can find in +code+
     # and associate it with +container+
     def scan_for_resource(container, code)
+        code = [code] unless code.is_a?(Array)
         code.each do |stmt|
             scan_for_resource(container,stmt.children) if stmt.is_a?(Puppet::Parser::AST::ASTArray)
 
diff --git a/spec/unit/util/rdoc/parser.rb b/spec/unit/util/rdoc/parser.rb
index b05df6d..de11832 100755
--- a/spec/unit/util/rdoc/parser.rb
+++ b/spec/unit/util/rdoc/parser.rb
@@ -321,6 +321,12 @@ describe RDoc::Parser do
             @code.stubs(:is_a?).with(Puppet::Parser::AST::ASTArray).returns(true)
         end
 
+        it "should also scan mono-instruction code" do
+            @class.expects(:add_include).with { |i| i.is_a?(RDoc::Include) and i.name == "myclass" and i.comment == "mydoc" }
+
+            @parser.scan_for_include_or_require(@class,create_stmt("include"))
+        end
+
         it "should register recursively includes to the current container" do
             @code.stubs(:children).returns([ create_stmt("include") ])
 
@@ -354,6 +360,12 @@ describe RDoc::Parser do
             @class.expects(:add_constant).with { |i| i.is_a?(RDoc::Constant) and i.name == "myvar" and i.comment == "mydoc" }
             @parser.scan_for_vardef(@class, [ @code ])
         end
+
+        it "should also scan mono-instruction code" do
+            @class.expects(:add_constant).with { |i| i.is_a?(RDoc::Constant) and i.name == "myvar" and i.comment == "mydoc" }
+
+            @parser.scan_for_vardef(@class, @stmt)
+        end
     end
 
     describe "when scanning for resources" do
@@ -375,6 +387,12 @@ describe RDoc::Parser do
             @class.expects(:add_resource).with { |i| i.is_a?(RDoc::PuppetResource) and i.title == "myfile" and i.comment == "mydoc" }
             @parser.scan_for_resource(@class, [ @code ])
         end
+
+        it "should also scan mono-instruction code" do
+            @class.expects(:add_resource).with { |i| i.is_a?(RDoc::PuppetResource) and i.title == "myfile" and i.comment == "mydoc" }
+
+            @parser.scan_for_resource(@class, @stmt)
+        end
     end
 
     describe "when parsing plugins" do

-- 
Puppet packaging for Debian



More information about the Pkg-puppet-devel mailing list