Method: Puppet::Util::RDoc.rdoc

Defined in:
lib/puppet/util/rdoc.rb

.rdoc(outputdir, files, charset = nil) ⇒ Object

launch a rdoc documentation process with the files/dir passed in files



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/puppet/util/rdoc.rb', line 7

def rdoc(outputdir, files, charset = nil)

  # then rdoc
  require 'rdoc/rdoc'
  require 'rdoc/options'

  # load our parser
  require 'puppet/util/rdoc/parser'

  r = RDoc::RDoc.new

  # specify our own format & where to output
  options = [ "--fmt", "puppet",
              "--quiet",
              "--exclude", "/modules/[^/]*/spec/.*$",
              "--exclude", "/modules/[^/]*/files/.*$",
              "--exclude", "/modules/[^/]*/tests/.*$",
              "--exclude", "/modules/[^/]*/templates/.*$",
              "--op", outputdir ]

  options << "--force-update"
  options += [ "--charset", charset] if charset
  # Rdoc root default is Dir.pwd, but the win32-dir gem monkey patches Dir.pwd
  # replacing Ruby's normal / with \.  When RDoc generates relative paths it
  # uses relative_path_from that will generate errors when the slashes don't
  # properly match.  This is a workaround for that issue.
  if Puppet.features.microsoft_windows? && RDoc::VERSION !~ /^[0-3]\./
    options += [ "--root", Dir.pwd.gsub(/\\/, '/')]
  end
  options += files

  # launch the documentation process
  r.document(options)
end