summaryrefslogtreecommitdiff
path: root/lib/rdoc/rdoc.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-02 00:32:30 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-02-02 00:32:30 +0000
commitcc2a16d94d744d14d4a5eb06eca22137f8a9b79e (patch)
tree2907a20e2d9ae3a2831707056bb3fe2d384b066d /lib/rdoc/rdoc.rb
parent918f625a5eeba35b9b191cb39c1d634b4cc7efee (diff)
Import RDoc 3.5.1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30760 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/rdoc.rb')
-rw-r--r--lib/rdoc/rdoc.rb42
1 files changed, 28 insertions, 14 deletions
diff --git a/lib/rdoc/rdoc.rb b/lib/rdoc/rdoc.rb
index c57b1d42d3..c66e66a87c 100644
--- a/lib/rdoc/rdoc.rb
+++ b/lib/rdoc/rdoc.rb
@@ -197,6 +197,7 @@ option)
end unless @options.force_output
else
FileUtils.mkdir_p dir
+ FileUtils.touch output_flag_file dir
end
last
@@ -206,7 +207,7 @@ option)
# Update the flag file in an output directory.
def update_output_dir(op_dir, time, last = {})
- return if @options.dry_run
+ return if @options.dry_run or not @options.update_output_dir
open output_flag_file(op_dir), "w" do |f|
f.puts time.rfc2822
@@ -353,12 +354,12 @@ The internal error was:
def parse_files files
file_list = gather_files files
+ @stats = RDoc::Stats.new file_list.size, @options.verbosity
return [] if file_list.empty?
file_info = []
- @stats = RDoc::Stats.new file_list.size, @options.verbosity
@stats.begin_adding
file_info = file_list.map do |filename|
@@ -381,21 +382,30 @@ The internal error was:
end
##
- # Format up one or more files according to the given arguments.
+ # 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
+ # <tt>%w[-q -o doc -t My\ Doc\ Title]</tt>. #document will automatically
+ # call RDoc::Options#finish if an options instance was given.
#
- # 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 <tt>rdoc --help</tt>. By default, output will be stored in a directory
- # called +doc+ below the current directory, so make sure you're somewhere
- # writable before invoking.
-
- def document(argv)
+ # For a list of options, see either RDoc::Options or <tt>rdoc --help</tt>.
+ #
+ # By default, output will be stored in a directory called "doc" below the
+ # current directory, so make sure you're somewhere writable before invoking.
+
+ def document options
RDoc::TopLevel.reset
RDoc::Parser::C.reset
- @options = RDoc::Options.new
- @options.parse argv
+ if RDoc::Options === options then
+ @options = options
+ @options.finish
+ else
+ @options = RDoc::Options.new
+ @options.parse options
+ end
if @options.pipe then
handle_pipe
@@ -416,10 +426,13 @@ The internal error was:
RDoc::TopLevel.complete @options.visibility
+ @stats.coverage_level = @options.coverage_report
+
if @options.coverage_report then
puts
+
puts @stats.report
- elsif file_info.empty?
+ elsif file_info.empty? then
$stderr.puts "\nNo newer files." unless @options.quiet
else
gen_klass = @options.generator
@@ -474,6 +487,7 @@ begin
load extension
rescue => e
warn "error loading #{extension.inspect}: #{e.message} (#{e.class})"
+ warn "\t#{e.backtrace.join "\n\t"}" if $DEBUG
end
end
end