document(argv)
public
Format up one or more files according to the given arguments.
For simplicity, argv is an array of strings, equivalent to the
strings that would be passed on the command line. (This isn’t a
coincidence, as we do pass in ARGV when running interactively).
For a list of options, see rdoc/rdoc.rb. By default, output will be stored
in a directory called doc below the current directory, so make sure
you’re somewhere writable before invoking.
Throws: RDoc::Error on error
Show source
def document(argv)
RDoc::TopLevel.reset
RDoc::Parser::C.reset
@options = RDoc::Options.new
@options.parse argv
if @options.pipe then
handle_pipe
exit
end
@exclude = @options.exclude
@last_modified = setup_output_dir @options.op_dir, @options.force_update
start_time = Time.now
file_info = parse_files @options.files
@options.title = "RDoc Documentation"
if file_info.empty?
$stderr.puts "\nNo newer files." unless @options.quiet
else
gen_klass = @options.generator
unless @options.quiet then
$stderr.puts "\nGenerating #{gen_klass.name.sub(/^.*::/, '')}..."
end
@generator = gen_klass.for @options
pwd = Dir.pwd
Dir.chdir @options.op_dir do
begin
self.class.current = self
@generator.generate file_info
update_output_dir ".", start_time, @last_modified
ensure
self.class.current = nil
end
end
end
unless @options.quiet or not @stats then
puts
@stats.print
end
end