diff options
| author | Max Martin <max@puppetlabs.com> | 2011-03-08 13:32:25 -0800 |
|---|---|---|
| committer | Max Martin <max@puppetlabs.com> | 2011-03-08 13:32:25 -0800 |
| commit | 9d551be70ab2a5d64a75a5c497534b0413cd3d81 (patch) | |
| tree | 062d88419140fd3d848d68946c76cd3e75baeec5 /lib | |
| parent | c3ec3d100fb27211bf86c12bdc759d1fa1afce25 (diff) | |
| parent | 2a915725adf0ccefcc28653cbba2219925194594 (diff) | |
| download | puppet-9d551be70ab2a5d64a75a5c497534b0413cd3d81.tar.gz puppet-9d551be70ab2a5d64a75a5c497534b0413cd3d81.tar.xz puppet-9d551be70ab2a5d64a75a5c497534b0413cd3d81.zip | |
Merge branch 'ticket/next/4798-rdoc-fixes' into next
* ticket/next/4798-rdoc-fixes:
(#4798) Make rdoc work if moduledir & manifestdir overlap
maint: Fix rdoc when documenting manifest files
maint: Move puppetdoc settings to defaults so we can use them in tests
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/puppet/application/doc.rb | 8 | ||||
| -rw-r--r-- | lib/puppet/defaults.rb | 4 | ||||
| -rw-r--r-- | lib/puppet/util/rdoc.rb | 14 | ||||
| -rw-r--r-- | lib/puppet/util/rdoc/parser.rb | 4 |
4 files changed, 12 insertions, 18 deletions
diff --git a/lib/puppet/application/doc.rb b/lib/puppet/application/doc.rb index 3bfe41653..74811919e 100644 --- a/lib/puppet/application/doc.rb +++ b/lib/puppet/application/doc.rb @@ -1,7 +1,6 @@ require 'puppet/application' class Puppet::Application::Doc < Puppet::Application - should_not_parse_config run_mode :master @@ -140,7 +139,7 @@ COPYRIGHT Copyright (c) 2005-2007 Puppet Labs, LLC Licensed under the GNU Public License - HELP +HELP end def handle_unknown( opt, arg ) @@ -163,11 +162,6 @@ License files += command_line.args Puppet.info "scanning: #{files.inspect}" - Puppet.settings.setdefaults( - "puppetdoc", - - "document_all" => [false, "Document all resources"] - ) Puppet.settings[:document_all] = options[:all] || false begin require 'puppet/util/rdoc' diff --git a/lib/puppet/defaults.rb b/lib/puppet/defaults.rb index 576acfeb6..f308d4476 100644 --- a/lib/puppet/defaults.rb +++ b/lib/puppet/defaults.rb @@ -822,4 +822,8 @@ module Puppet directories." ] ) + setdefaults( + :puppetdoc, + :document_all => [false, "Document all resources"] + ) end diff --git a/lib/puppet/util/rdoc.rb b/lib/puppet/util/rdoc.rb index bdac579d6..c00bc6f85 100644 --- a/lib/puppet/util/rdoc.rb +++ b/lib/puppet/util/rdoc.rb @@ -31,6 +31,7 @@ module Puppet::Util::RDoc options << "--force-update" if Options::OptionList.options.any? { |o| o[0] == "--force-update" } options += [ "--charset", charset] if charset options += files + #TODO dedup file paths (not strict duplication sense, parents, children, etc # launch the documentation process r.document(options) @@ -53,17 +54,10 @@ module Puppet::Util::RDoc # of a manifest def output(file, ast) astobj = [] - ast.nodes.each do |name, k| - astobj << k if k.file == file + ast.instantiate('').each do |resource_type| + astobj << resource_type if resource_type.file == file end - ast.hostclasses.each do |name,k| - astobj << k if k.file == file - end - - ast.definitions.each do |name, k| - astobj << k if k.file == file - end astobj.sort! {|a,b| a.line <=> b.line }.each do |k| output_astnode_doc(k) end @@ -89,4 +83,4 @@ module Puppet::Util::RDoc end end -end
\ No newline at end of file +end diff --git a/lib/puppet/util/rdoc/parser.rb b/lib/puppet/util/rdoc/parser.rb index 2b89baace..0f746e2ea 100644 --- a/lib/puppet/util/rdoc/parser.rb +++ b/lib/puppet/util/rdoc/parser.rb @@ -34,17 +34,18 @@ class Parser # main entry point def scan environment = Puppet::Node::Environment.new + @known_resource_types = environment.known_resource_types unless environment.known_resource_types.watching_file?(@input_file_name) Puppet.info "rdoc: scanning #{@input_file_name}" if @input_file_name =~ /\.pp$/ @parser = Puppet::Parser::Parser.new(environment) @parser.file = @input_file_name - @known_resource_types = environment.known_resource_types @parser.parse.instantiate('').each do |type| @known_resource_types.add type end end end + scan_top_level(@top_level) @top_level end @@ -342,6 +343,7 @@ class Parser # that contains the documentation def parse_elements(container) Puppet.debug "rdoc: scanning manifest" + @known_resource_types.hostclasses.values.sort { |a,b| a.name <=> b.name }.each do |klass| name = klass.name if klass.file == @input_file_name |
