summaryrefslogtreecommitdiff
path: root/lib/rdoc/options.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/options.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/options.rb')
-rw-r--r--lib/rdoc/options.rb67
1 files changed, 45 insertions, 22 deletions
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 3d76569a7e..c5f3b36b8d 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -71,7 +71,7 @@ class RDoc::Options
attr_accessor :formatter
##
- # Description of the output generator (set with the <tt>-fmt</tt> option)
+ # Description of the output generator (set with the <tt>--fmt</tt> option)
attr_accessor :generator
@@ -149,6 +149,11 @@ class RDoc::Options
attr_accessor :title
##
+ # Should RDoc update the timestamps in the output dir?
+
+ attr_accessor :update_output_dir
+
+ ##
# Verbosity, zero means quiet
attr_accessor :verbosity
@@ -188,6 +193,7 @@ class RDoc::Options
@template = nil
@template_dir = nil
@title = nil
+ @update_output_dir = true
@verbosity = 1
@visibility = :protected
@webcvs = nil
@@ -241,6 +247,35 @@ class RDoc::Options
end
##
+ # Completes any unfinished option setup business such as filtering for
+ # existent files, creating a regexp for #exclude and setting a default
+ # #template.
+
+ def finish
+ @op_dir ||= 'doc'
+
+ @rdoc_include << "." if @rdoc_include.empty?
+
+ if @exclude.empty? then
+ @exclude = nil
+ else
+ @exclude = Regexp.new(@exclude.join("|"))
+ end
+
+ check_files
+
+ # If no template was specified, use the default template for the output
+ # formatter
+
+ unless @template then
+ @template = @generator_name
+ @template_dir = template_dir_for @template
+ end
+
+ self
+ end
+
+ ##
# Returns a properly-space list of generators and their descriptions.
def generator_descriptions
@@ -267,7 +302,7 @@ class RDoc::Options
end
##
- # Parse command line options.
+ # Parses command line options.
def parse(argv)
ignore_invalid = true
@@ -449,9 +484,11 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--[no-]coverage-report", "--[no-]dcov", "-C",
+ opt.on("--[no-]coverage-report=[LEVEL]", "--[no-]dcov", "-C", Integer,
"Prints a report on undocumented items.",
"Does not generate files.") do |value|
+ value = 0 if value.nil? # Integer converts -C to nil
+
@coverage_report = value
@force_update = true if value
end
@@ -669,26 +706,9 @@ Usage: #{opt.program_name} [options] [names...]
end
end
- @op_dir ||= 'doc'
@files = argv.dup
- @rdoc_include << "." if @rdoc_include.empty?
-
- if @exclude.empty? then
- @exclude = nil
- else
- @exclude = Regexp.new(@exclude.join("|"))
- end
-
- check_files
-
- # If no template was specified, use the default template for the output
- # formatter
-
- unless @template then
- @template = @generator_name
- @template_dir = template_dir_for @template
- end
+ finish
end
##
@@ -725,7 +745,10 @@ Usage: #{opt.program_name} [options] [names...]
@generator_name = generator_name
@generator_options << @generator
- @generator.setup_options self if @generator.respond_to? :setup_options
+ if @generator.respond_to? :setup_options then
+ @option_parser ||= OptionParser.new
+ @generator.setup_options self
+ end
end
##