summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/rdoc/parser.rb
Commit message (Collapse)AuthorAgeFilesLines
* Fix issue with forward and backslashes in Windows pathsJosh Cooper2011-07-261-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The environment validates its modulepath and manifestdir settings, but it uses Dir.getwd to convert a relative path into an absolute path. The problem is that on Windows, Dir.getwd returns a path with backslashes. (Interestingly this only happens when puppet is loaded, not in irb for example.) And since we do not yet support backslashes in Windows paths or UNC paths, the directory is not included in the environment. For the time being, I am using File.expand_path to normalize the path. It has the side-effect of converting backslashes to forward slashes. This is sufficient to work around backslashes in Dir.getwd. In the near future, I will be refactoring how paths are split, validated, tested, etc, and I have a REMIND in place to fix the environment. But as a result of this change it exposed a bug in our rdoc parser dealing with the finding the root of a path. The parser assumed that the root was '/', but caused an infinite loop when passed a Windows path. I added a test for this case, which is only run on Windows, because on Unix File.dirname("C:/") == '.'. After all of that, I had to disable one of the rdoc spec tests, because it attempted to reproduce a specific bug, which caused rdoc to try to create a directory of the form: C:/.../files/C:/.... Of course, this fails because ':' is not a valid filename character on Windows. Paired-with: Nick Lewis <nick@puppetlabs.com> Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* (#6820) Fix RDOC parser to work with Ruby 1.9Matt Robinson2011-03-231-3/+9
| | | | | | | | Lovely RDOC changed where it put everything in Ruby 1.9. Now there's some conditional logic depending on Ruby version to determine which files to requrie. The tests still fail, but at least they run now. Reviewed-by: Jacob Helwig <jacob@puppetlabs.com>
* (#4798) Make rdoc work if moduledir & manifestdir overlapMatt Robinson2011-03-081-1/+3
| | | | | | | Merging 2.6.next into next caused a regression; this commit fixes that regression. Paired-with:Max Martin <max@puppetlabs.com>
* Merge branch '2.6.next' into nextMatt Robinson2011-03-071-3/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This was a particularly nasty merge, so rather than hold up merges into next any longer, I'm going to push this merge with a few outstanding problems. The tests that were failing in the following areas have been marked pending, and will be addressed separately, immediately following this push. TODO: Verify that brice's rdoc change is still valid: tests to show that line numbers from class, define and node get into the ast Fix mount parsed_spec spec/unit/provider/mount/parsed_spec.rb * 2.6.next: (85 commits) (#5148) Fix failing spec due to timezone (#5148) Add support for PSON to facts (#6338) Remove inventory indirection, and move to facts indirection (#6445) Fix inline docs: puppet agent does not accept --mkusers Update CHANGELOG and version for 2.6.6rc1 (#6541) Fix content with checksum truncation bug (#6418) Recursive files shouldn't be audited (#6541) maint: whitespace cleanup on the file integration spec (#6541) Fix content with checksum truncation bug (#5466) Write specs for output of puppet resource (#5466) Monkey patch Symbol so that you can sort them (#5466) Fixed puppet resource bug with trailing , Update CHANGELOG for 2.6.5 (#4922) Don't truncate remotely-sourced files on 404 (#6338) Remove unused version control tags Maint: Align tabs in a code block in the Augeas type. (#6509) Inline docs: Fix erroneous code block in directoryservice provider for computer type Maint: Rewrite comments about symlinks to reflect best practice. (#6509) Inline docs: Fix broken lists in Launchd provider. (#6509) Inline docs: Fix broken code blocks in zpool type ... Manually Resolved Conflicts: lib/puppet/application/inspect.rb lib/puppet/defaults.rb lib/puppet/file_bucket/dipper.rb lib/puppet/network/http/handler.rb lib/puppet/node/facts.rb lib/puppet/parser/parser.rb lib/puppet/parser/parser_support.rb lib/puppet/util/command_line/puppet lib/puppet/util/command_line/puppetd lib/puppet/util/command_line/puppetmasterd lib/puppet/util/monkey_patches.rb lib/puppet/util/rdoc/parser.rb spec/unit/application/agent_spec.rb spec/unit/file_bucket/file_spec.rb spec/unit/indirector/file_bucket_file/file_spec.rb spec/unit/network/http/handler_spec.rb spec/unit/parser/parser_spec.rb spec/unit/provider/mount/parsed_spec.rb
| * Fix #6281 - Make sure puppetdoc analyzes all filesBrice Figureau2011-02-111-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | It can happen that when parsing a file puppet parses other manifests if they get imported (this is at least true for site.pp, even in ignoreimport=true). Thus those files are now "watched". But puppetdoc needs to analyze all files, and since 99c101 we are now checking if the file was already parsed to not reparse it again. If that was the case, though, we weren't analyzing the produced code. Thus it was possible to not produce documentation for the site.pp content. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #6280 - puppetdoc crashing on string interpolationBrice Figureau2011-02-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | The following manifest was crashing puppetdoc: class test { include "test::$operatingsystem" } Because the quoted string is "rendered" as a concat AST, which in turn ended being an array when entering RDoc. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Partial merge to 2.6.2rc1 : Merge commit '574812e' into nextJesse Wolfe2010-10-041-10/+12
|\| | | | | | | | | | | | | | | | | The API for AST objects has changed, making the initialization of this spec somewhat more complicated. Also, git seems to have been confused by whitespace changes. Manually Resolved Conflicts: lib/puppet/parser/ast/resource.rb
| * (#4860) Fix wrong method name.. params seems to be renamed to parametersSimon Effenberg2010-09-281-1/+1
| |
* | Partial merge to 2.6.2rc1 : Merge commit '99c1019' into nextJesse Wolfe2010-10-041-9/+11
|\| | | | | | | | | | | | | | | | | | | This conflict was a little too complicated for diff to figure out, but the resolution is actually fairly mechanical. Some unit tests changed because they were mocking unnecessarily. Manually Resolved Conflicts: lib/puppet/util/rdoc/parser.rb spec/unit/util/rdoc/parser_spec.rb
| * [#4798] Puppet doc manifests documentation mode brokenPaul Berry2010-09-221-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | When running puppet doc, if the directory containing the user's specified manifest file overlaps with the modules directory (i.e. they are the same directory or one contains the other), Puppet doc would try to parse the overlapping files twice, triggering an exception which made the documentation run fail. Fixed the bug by adding a check to the RDoc::Parser#scan method to prevent re-parsing of files that have already been parsed. Also added a spec test to verify that this works.
* | [#4496]+[#4521]+[#4522] Add structures to the AST to represent type ↵Paul Berry2010-08-131-5/+9
|/ | | | | | | | | | | | | | | | | | | definitions (classes, definitions, and nodes). Previously, type definitions were not represented directly in the AST. Instead, the parser would instantiate types and insert them into known_resource_types as soon as they were parsed. This made it difficult to distinguish which types had come from the file that was just parsed and which types had been loaded previously, which led to bug 4496. A side-effect of this change is that the user is no longer allowed to define types inside of conditional constructs (such as if/else). This was allowed before but had unexpected semantics (bugs 4521 and 4522). It is still possible, however, to place an "include" statement inside a conditional construct, and have that "include" statement trigger the autoloading of a file that instantiates types.
* Fix #4286 - rename puppetdoc global module <site> to __site__Brice Figureau2010-07-251-3/+5
| | | | | | | | | < and > might be invalid or borderline chars to use for a file name or an url. This patch changes those characters to __. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Code smell: Two space indentationMarkus Roberts2010-07-091-416/+416
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 106806 occurances of ^( +)(.*$) with The ruby community almost universally (i.e. everyone but Luke, Markus, and the other eleven people who learned ruby in the 1900s) uses two-space indentation. 3 Examples: The code: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") becomes: end # Tell getopt which arguments are valid def test_get_getopt_args element = Setting.new :name => "foo", :desc => "anything", :settings => Puppet::Util::Settings.new assert_equal([["--foo", GetoptLong::REQUIRED_ARGUMENT]], element.getopt_args, "Did not produce appropriate getopt args") The code: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object becomes: assert_equal(str, val) assert_instance_of(Float, result) end # Now test it with a passed object The code: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end becomes: end assert_nothing_raised do klass[:Yay] = "boo" klass["Cool"] = :yayness end
* Code smell: Avoid needless decorationsMarkus Roberts2010-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 704 occurances of (.*)\b([a-z_]+)\(\) with \1\2 3 Examples: The code: ctx = OpenSSL::SSL::SSLContext.new() becomes: ctx = OpenSSL::SSL::SSLContext.new The code: skip() becomes: skip The code: path = tempfile() becomes: path = tempfile * Replaced 31 occurances of ^( *)end *#.* with \1end 3 Examples: The code: becomes: The code: end # Dir.foreach becomes: end The code: end # def becomes: end
* Code smell: Use ||= for conditional initializationMarkus Roberts2010-07-091-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | Replaced 55 occurances of ([$@]?\w+) += +(.*) +(if +\1.nil\?|if +! *\1|unless +\1|unless +defined\?\(\1\))$ with \1 ||= \2 3 Examples: The code: @sync becomes: @sync The code: becomes: The code: if @yydebug becomes: if @yydebug
* Code smell: Avoid explicit returnsMarkus Roberts2010-07-091-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced 583 occurances of (DEF) (LINES) return (.*) end with 3 Examples: The code: def consolidate_failures(failed) filters = Hash.new { |h,k| h[k] = [] } failed.each do |spec, failed_trace| if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } filters[f] << spec break end end return filters end becomes: def consolidate_failures(failed) filters = Hash.new { |h,k| h[k] = [] } failed.each do |spec, failed_trace| if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } filters[f] << spec break end end filters end The code: def retrieve return_value = super return_value = return_value[0] if return_value && return_value.is_a?(Array) return return_value end becomes: def retrieve return_value = super return_value = return_value[0] if return_value && return_value.is_a?(Array) return_value end The code: def fake_fstab os = Facter['operatingsystem'] if os == "Solaris" name = "solaris.fstab" elsif os == "FreeBSD" name = "freebsd.fstab" else # Catchall for other fstabs name = "linux.fstab" end oldpath = @provider_class.default_target return fakefile(File::join("data/types/mount", name)) end becomes: def fake_fstab os = Facter['operatingsystem'] if os == "Solaris" name = "solaris.fstab" elsif os == "FreeBSD" name = "freebsd.fstab" else # Catchall for other fstabs name = "linux.fstab" end oldpath = @provider_class.default_target fakefile(File::join("data/types/mount", name)) end
* Code smell: Line modifiers are preferred to one-line blocks.Markus Roberts2010-07-091-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 6 occurances of (while .*?) *do$ with The do is unneeded in the block header form and causes problems with the block-to-one-line transformation. 3 Examples: The code: while line = f.gets do becomes: while line = f.gets The code: while line = shadow.gets do becomes: while line = shadow.gets The code: while wrapper = zeros.pop do becomes: while wrapper = zeros.pop * Replaced 19 occurances of ((if|unless) .*?) *then$ with The then is unneeded in the block header form and causes problems with the block-to-one-line transformation. 3 Examples: The code: if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } then becomes: if f = test_files_for(failed).find { |f| failed_trace =~ Regexp.new(f) } The code: unless defined?(@spec_command) then becomes: unless defined?(@spec_command) The code: if c == ?\n then becomes: if c == ?\n * Replaced 758 occurances of ((?:if|unless|while|until) .*) (.*) end with The one-line form is preferable provided: * The condition is not used to assign a variable * The body line is not already modified * The resulting line is not too long 3 Examples: The code: if Puppet.features.libshadow? has_feature :manages_passwords end becomes: has_feature :manages_passwords if Puppet.features.libshadow? The code: unless (defined?(@current_pool) and @current_pool) @current_pool = process_zpool_data(get_pool_data) end becomes: @current_pool = process_zpool_data(get_pool_data) unless (defined?(@current_pool) and @current_pool) The code: if Puppet[:trace] puts detail.backtrace end becomes: puts detail.backtrace if Puppet[:trace]
* Code smell: Use string interpolationMarkus Roberts2010-07-091-15/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Replaced 83 occurances of (.*)" *[+] *([$@]?[\w_0-9.:]+?)(.to_s\b)?(?! *[*(%\w_0-9.:{\[]) with \1#{\2}" 3 Examples: The code: puts "PUPPET " + status + ": " + process + ", " + state becomes: puts "PUPPET " + status + ": " + process + ", #{state}" The code: puts "PUPPET " + status + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" The code: }.compact.join( "\n" ) + "\n" + t + "]\n" becomes: }.compact.join( "\n" ) + "\n#{t}" + "]\n" * Replaced 21 occurances of (.*)" *[+] *" with \1 3 Examples: The code: puts "PUPPET #{status}" + ": #{process}" + ", #{state}" becomes: puts "PUPPET #{status}" + ": #{process}, #{state}" The code: puts "PUPPET #{status}" + ": #{process}, #{state}" becomes: puts "PUPPET #{status}: #{process}, #{state}" The code: res = self.class.name + ": #{@name}" + "\n" becomes: res = self.class.name + ": #{@name}\n" * Don't use string concatenation to split lines unless they would be very long. Replaced 11 occurances of (.*)(['"]) *[+] *(['"])(.*) with 3 Examples: The code: o.define_head "The check_puppet Nagios plug-in checks that specified " + "Puppet process is running and the state file is no " + becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + The code: o.separator "Mandatory arguments to long options are mandatory for " + "short options too." becomes: o.separator "Mandatory arguments to long options are mandatory for short options too." The code: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no " + "older than specified interval." becomes: o.define_head "The check_puppet Nagios plug-in checks that specified Puppet process is running and the state file is no older than specified interval." * Replaced no occurances of do (.*?) end with {\1} * Replaced 1488 occurances of "([^"\n]*%s[^"\n]*)" *% *(.+?)(?=$| *\b(do|if|while|until|unless|#)\b) with 20 Examples: The code: args[0].split(/\./).map do |s| "dc=%s"%[s] end.join(",") becomes: args[0].split(/\./).map do |s| "dc=#{s}" end.join(",") The code: puts "%s" % Puppet.version becomes: puts "#{Puppet.version}" The code: raise "Could not find information for %s" % node becomes: raise "Could not find information for #{node}" The code: raise Puppet::Error, "Cannot create %s: basedir %s is a file" % [dir, File.join(path)] becomes: raise Puppet::Error, "Cannot create #{dir}: basedir #{File.join(path)} is a file" The code: Puppet.err "Could not run %s: %s" % [client_class, detail] becomes: Puppet.err "Could not run #{client_class}: #{detail}" The code: raise "Could not find handler for %s" % arg becomes: raise "Could not find handler for #{arg}" The code: Puppet.err "Will not start without authorization file %s" % Puppet[:authconfig] becomes: Puppet.err "Will not start without authorization file #{Puppet[:authconfig]}" The code: raise Puppet::Error, "Could not deserialize catalog from pson: %s" % detail becomes: raise Puppet::Error, "Could not deserialize catalog from pson: #{detail}" The code: raise "Could not find facts for %s" % Puppet[:certname] becomes: raise "Could not find facts for #{Puppet[:certname]}" The code: raise ArgumentError, "%s is not readable" % path becomes: raise ArgumentError, "#{path} is not readable" The code: raise ArgumentError, "Invalid handler %s" % name becomes: raise ArgumentError, "Invalid handler #{name}" The code: debug "Executing '%s' in zone %s with '%s'" % [command, @resource[:name], str] becomes: debug "Executing '#{command}' in zone #{@resource[:name]} with '#{str}'" The code: raise Puppet::Error, "unknown cert type '%s'" % hash[:type] becomes: raise Puppet::Error, "unknown cert type '#{hash[:type]}'" The code: Puppet.info "Creating a new certificate request for %s" % Puppet[:certname] becomes: Puppet.info "Creating a new certificate request for #{Puppet[:certname]}" The code: "Cannot create alias %s: object already exists" % [name] becomes: "Cannot create alias #{name}: object already exists" The code: return "replacing from source %s with contents %s" % [metadata.source, metadata.checksum] becomes: return "replacing from source #{metadata.source} with contents #{metadata.checksum}" The code: it "should have a %s parameter" % param do becomes: it "should have a #{param} parameter" do The code: describe "when registring '%s' messages" % log do becomes: describe "when registring '#{log}' messages" do The code: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration%stest" % l } becomes: paths = %w{a b c d e f g h}.collect { |l| "/tmp/iteration#{l}test" } The code: assert_raise(Puppet::Error, "Check '%s' did not fail on false" % check) do becomes: assert_raise(Puppet::Error, "Check '#{check}' did not fail on false") do
* Update RDoc parser to reflect change of custom plugin and fact locationsJames Turnbull2010-07-091-1/+1
|
* Fixing callers to Parser to only pass environmentLuke Kanies2010-02-171-1/+1
| | | | | | | We previously passed a hash of options but now just the environment. Signed-off-by: Luke Kanies <luke@reductivelabs.com>
* Adapt to method name change since 8971d8Brice Figureau2010-01-181-3/+3
| | | | | | | | | When the definition/hostclass/node AST types were removed, the parentclass method was renamed to 'parent'. This patch fixes the incorrect rdoc usage (and some deeper integration test so that it won't happen again). Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Merge branch '0.25.x'Luke Kanies2009-12-211-3/+14
|\ | | | | | | | | | | | | | | Conflicts: lib/puppet/agent.rb lib/puppet/application/puppetd.rb lib/puppet/parser/ast/leaf.rb lib/puppet/util/rdoc/parser.rb
| * Fix #2784 - puppetdoc/rdoc didn't parse mono-instruction class contentBrice Figureau2009-11-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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@daysofwonder.com>
| * Fix #2796 - Fix puppetdoc rdoc selector parsingBrice Figureau2009-11-121-3/+6
| | | | | | | | | | | | | | | | | | This patch fix this bug by adding more to_s methods to ast member so that puppetdoc can just to_s the AST to reconstruct the original puppet code. Of course this is not perfect, but should work most of the time. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
| * Fix #2795 - puppetdoc rdoc reports a better error messageBrice Figureau2009-11-121-13/+23
| | | | | | | | | | | | | | | | | | | | When puppetdoc rdoc dies with an unhandled exception, the error message produced didn't mention the file and line where the parser choked. This patch fixes this by trying to locate on which AST structure the rdoc system failed. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fixing #2596 - Node, Class, Definition are not ASTLuke Kanies2009-12-091-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit extracts these three classes into a single ResourceType class in the Parser heirarchy, now completely independent of the AST heirarchy. Most of the other changes are just changing the interface to the new class, which is greatly simplified over the previous classes. This opens up the possibility of drastically simplifying a lot of this other code, too -- in particular, replacing the reference to the parser with a reference to the (soon to be renamed) LoadedCode class. Signed-off-by: Luke Kanies <luke@madstop.com>
* | Fix 2841 - Puppetdoc/RDoc parses realize functionBrice Figureau2009-12-021-14/+31
| | | | | | | | | | | | | | | | Puppetdoc wasn't parsing the realize function. This patch let puppetdoc find realize and display in RDoc html mode the list of realized resource per class or node. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2796 - Fix puppetdoc rdoc selector parsingBrice Figureau2009-11-121-3/+6
| | | | | | | | | | | | | | | | | | This patch fix this bug by adding more to_s methods to ast member so that puppetdoc can just to_s the AST to reconstruct the original puppet code. Of course this is not perfect, but should work most of the time. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2795 - puppetdoc rdoc reports a better error messageBrice Figureau2009-11-121-13/+23
| | | | | | | | | | | | | | | | | | | | When puppetdoc rdoc dies with an unhandled exception, the error message produced didn't mention the file and line where the parser choked. This patch fixes this by trying to locate on which AST structure the rdoc system failed. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* | Fix #2784 - puppetdoc/rdoc didn't parse mono-instruction class contentBrice Figureau2009-11-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | 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@daysofwonder.com>
* | Covers the RDoc Puppet Parser with specsBrice Figureau2009-10-241-5/+5
| | | | | | | | | | | | | | | | 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>
* | Fix #2703 - add 'require' to puppetdocBrice Figureau2009-10-241-7/+7
|/ | | | | | | Puppetdoc wasn't parsing 'require'. This patch adds a 'require' section to list all required class from nodes and classes. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2459 - puppetdoc added namespace classes as RDoc modules instead of classesBrice Figureau2009-07-301-1/+5
| | | | | | | | | | | | | Puppetdoc while parsing a class name creates intermediate RDoc classes to form a hierarchy. Due to a coding error, those intermediate classes were created as RDoc modules. Later, when puppetdoc was parsing the definition of one of this class, it wasn't finding it in RDoc list of classes (since it was recorded as a module). Puppetdoc was then creating documentation for two objects of the same name. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2454 - Definition named after a module don't show in puppetdocBrice Figureau2009-07-281-2/+0
| | | | | | | | RDoc#find_local_symbol can return a module. So if you have a defition of the same name as the module in which it is defined we weren't producing documentation for it. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2453 - puppetdoc mixes long class names that look alikeBrice Figureau2009-07-281-2/+14
| | | | | | | | | | The issue is that RDoc (the engine producing the documentation) is buggy: With a class named: A::C and a class named: D::A::E Then RDoc was attaching E under the root ::A and not D::A. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2422 & #2433 - make sure puppetdoc transform AST::Leaf boolean correctlyBrice Figureau2009-07-251-24/+5
| | | | | | | | | | AST nodes don't have a valid to_s that is producing a correct representation of said node. This patch adds some of the AST node to_s to produce correct values that can be used verbatim by puppetdoc to render the documentation. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2439 - let puppetdoc use loaded_codeBrice Figureau2009-07-241-3/+3
| | | | | | | | Since there isn't any unit test for puppetdoc rdoc code (my fault), nobody noticed it was using direct access to the parser AST array. This changeset fixes the way puppetdoc uses the parser results. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #2366 - puppetdoc was parsing classes in the wrong orderBrice Figureau2009-07-101-1/+2
| | | | | | | | | | | | It could happend that we were generating doc for subclasses before classes, in which case we were forgotting some parent class instance and recreating them. We ended up generating doc for some classes multiple times, from which some were missing documentation. The fix is to sort the parsed classes alphabetically, which auto- matically puts enclosing class before enclosed classes. Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>
* Fix #1815 - puppetdoc --all crash on resource overrideBrice Figureau2008-12-101-1/+1
|
* Manifest documentation generationBrice Figureau2008-11-171-0/+437
There is currently two type of documentation generation for manifests (module or modulepath): * RDoc HTML generation for modules and global manifests * console output for sole manifest Both version handles classes, defines, nodes, global variable assignements, and resources when --all is used. The usage is the following: For the rdoc variant: $ puppetdoc --mode rdoc --outputdir doc It uses the puppet.conf configuration file to get the modulepath and manifestdir settings. Those are overridable on the command line with --modulepath and --manifestdir. For the console output version: $ puppetdoc /path/to/manifests Signed-off-by: Brice Figureau <brice-puppet@daysofwonder.com>