lib/puppet/util/rdoc.rb in puppet-2.7.26 vs lib/puppet/util/rdoc.rb in puppet-3.0.0.rc4
- old
+ new
@@ -1,13 +1,17 @@
-
+require 'puppet/util'
module Puppet::Util::RDoc
-
module_function
# launch a rdoc documenation process
# with the files/dir passed in +files+
def rdoc(outputdir, files, charset = nil)
+ unless Puppet.features.rdoc1?
+ raise "the version of RDoc included in Ruby #{::RUBY_VERSION} is not supported"
+ end
+
+ begin
Puppet[:ignoreimport] = true
# then rdoc
require 'rdoc/rdoc'
require 'rdoc/options'
@@ -16,13 +20,14 @@
require 'puppet/util/rdoc/parser'
r = RDoc::RDoc.new
RDoc::RDoc::GENERATORS["puppet"] = RDoc::RDoc::Generator.new(
- "puppet/util/rdoc/generators/puppet_generator.rb",
- "PuppetGenerator".intern,
- "puppet")
+ "puppet/util/rdoc/generators/puppet_generator.rb",
+ :PuppetGenerator,
+ "puppet"
+ )
# specify our own format & where to output
options = [ "--fmt", "puppet",
"--quiet",
"--exclude", "/modules/[^/]*/files/.*$",
@@ -30,16 +35,16 @@
"--op", outputdir ]
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)
- rescue RDoc::RDocError => e
+ rescue RDoc::RDocError => e
raise Puppet::ParseError.new("RDoc error #{e}")
+ end
end
# launch a output to console manifest doc
def manifestdoc(files)
Puppet[:ignoreimport] = true
@@ -81,7 +86,6 @@
if stmt.is_a?(Puppet::Parser::AST::Resource)
puts stmt.doc if !stmt.doc.nil? and !stmt.doc.empty?
end
end
end
-
end