document(options)
public
Generates documentation or a coverage report depending upon the settings in
options.
options can be either an RDoc::Options instance or an array of strings
equivalent to the strings that would be passed on the command line like
%w[-q -o doc -t My\ Doc\ Title]. #document will automatically call RDoc::Options#finish if an options
instance was given.
For a list of options, see either RDoc::Options or rdoc --help.
By default, output will be stored in a directory called “doc” below the
current directory, so make sure
you’re somewhere writable before invoking.
Show source
def document options
RDoc::RDoc.reset
if RDoc::Options === options then
@options = options
@options.finish
else
@options = RDoc::Options.new
@options.parse options
end
if @options.pipe then
handle_pipe
exit
end
@exclude = @options.exclude
unless @options.coverage_report then
@last_modified = setup_output_dir @options.op_dir, @options.force_update
end
@start_time = Time.now
file_info = parse_files @options.files
@options.default_title = "RDoc Documentation"
RDoc::TopLevel.complete @options.visibility
@stats.coverage_level = @options.coverage_report
if @options.coverage_report then
puts
puts @stats.report
elsif file_info.empty? then
$stderr.puts "\nNo newer files." unless @options.quiet
else
gen_klass = @options.generator
@generator = gen_klass.new @options
generate file_info
end
if @stats and (@options.coverage_report or not @options.quiet) then
puts
puts @stats.summary
end
exit @stats.fully_documented? if @options.coverage_report
end