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
self.store = RDoc::Store.new
if RDoc::Options === options then
@options = options
@options.finish
else
@options = load_options
@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
@store.encoding = @options.encoding
@store.dry_run = @options.dry_run
@store.main = @options.main_page
@store.title = @options.title
@store.path = @options.op_dir
@start_time = Time.now
@store.load_cache
file_info = parse_files @options.files
@options.default_title = "RDoc Documentation"
@store.complete @options.visibility
@stats.coverage_level = @options.coverage_report
if @options.coverage_report then
puts
puts @stats.report.accept RDoc::Markup::ToRdoc.new
elsif file_info.empty? then
$stderr.puts "\nNo newer files." unless @options.quiet
else
gen_klass = @options.generator
@generator = gen_klass.new @store, @options
generate
end
if @stats and (@options.coverage_report or not @options.quiet) then
puts
puts @stats.summary.accept RDoc::Markup::ToRdoc.new
end
exit @stats.fully_documented? if @options.coverage_report
end