diff options
author | Brice Figureau <brice-puppet@daysofwonder.com> | 2009-10-13 23:31:54 +0200 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2009-10-24 08:36:58 +1100 |
commit | b1deb89bae67f7d71ffe412ce4fd8e99c6e1c159 (patch) | |
tree | 8f464dc3828e6499b17f3fc228b578b6297b6a8b /lib/puppet/util/rdoc/parser.rb | |
parent | ced5a7887836d1491273b5d6728589f494f8a337 (diff) | |
download | puppet-b1deb89bae67f7d71ffe412ce4fd8e99c6e1c159.tar.gz puppet-b1deb89bae67f7d71ffe412ce4fd8e99c6e1c159.tar.xz puppet-b1deb89bae67f7d71ffe412ce4fd8e99c6e1c159.zip |
Covers the RDoc Puppet Parser with specs
This doesn't cover all the code, only the part that interacts with
Puppet internals which is what matters when Puppet changes.
This patch also contains an integration test.
Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
Diffstat (limited to 'lib/puppet/util/rdoc/parser.rb')
-rw-r--r-- | lib/puppet/util/rdoc/parser.rb | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 6d0e8f7cc..aa34335cc 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -15,6 +15,8 @@ module RDoc class Parser extend ParserFactory + attr_accessor :ast, :input_file_name, :top_level + # parser registration into RDoc parse_files_matching(/\.(rb|pp)$/) @@ -39,8 +41,6 @@ class Parser @top_level end - private - # Due to a bug in RDoc, we need to roll our own find_module_named # The issue is that RDoc tries harder by asking the parent for a class/module # of the name. But by doing so, it can mistakenly use a module of same name @@ -277,8 +277,8 @@ class Parser # register method into the container meth = AnyMethod.new(declaration, name) - container.add_method(meth) meth.comment = define.doc + container.add_method(meth) look_for_directives_in(container, meth.comment) unless meth.comment.empty? meth.params = "( " + declaration + " )" meth.visibility = :public @@ -296,7 +296,7 @@ class Parser unless name.empty? document_class(name,klass,container) else # on main class document vardefs - code = klass.code.children unless klass.code.is_a?(Puppet::Parser::AST::ASTArray) + code = klass.code.children if klass.code.is_a?(Puppet::Parser::AST::ASTArray) code ||= klass.code scan_for_vardef(container, code) unless code.nil? end @@ -337,9 +337,9 @@ class Parser comments += $1 + "\n" elsif line =~ /^[ \t]*Facter.add\(['"](.*?)['"]\)/ current_fact = Fact.new($1,{}) - container.add_fact(current_fact) look_for_directives_in(container, comments) unless comments.empty? current_fact.comment = comments + container.add_fact(current_fact) current_fact.record_location(@top_level) comments = "" Puppet.debug "rdoc: found custom fact %s" % current_fact.name |