Module: Ratch::RDocUtils

Defined in:
lib/ratch/utils/rdoc.rb

Overview

Provides a pure-Ruby method for generating RDocs.

Constant Summary collapse

DEFAULT_RDOC_OPTIONS =
{
  :quiet => true
}

Instance Method Summary collapse

Instance Method Details

#rdoc(*files) ⇒ Object

RDoc command.

:call-seq:

rdoc(file1, file2, ..., :opt1 => val1, ...)


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/ratch/utils/rdoc.rb', line 15

def rdoc(*files)
  require 'rdoc/rdoc'

  options = Hash===files.last ? files.pop : {}
  options.rekey!(&:to_s)

  options['title'] ||= options.delete('T')

  options['debug']   = options['debug']   #|| debug?
  options['quiet']   = options['quiet']   #|| quiet?
  options['verbose'] = options['verbose'] #|| verbose?

  # apply pom (todo?)
  #options['title'] ||= metadata.title

  options = DEFAULT_RDOC_OPTIONS.merge(options)

  locally do
    rdoc = RDoc::RDoc.new
    opts = options.to_argv + files
    $stderr.puts("rdoc " + opts.join(' ')) if ($VERBOSE || $DEBUG)
    disable_warnings do
      rdoc.document(options.to_argv + files)
    end
  end
end