summaryrefslogtreecommitdiff
path: root/lib/rdoc/options.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rdoc/options.rb')
-rw-r--r--lib/rdoc/options.rb41
1 files changed, 32 insertions, 9 deletions
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index fe75b10..36b82ea 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -1,6 +1,8 @@
# We handle the parsing of options, and subsequently as a singleton
# object to be queried for option values
+require "rdoc/ri/ri_paths"
+
class Options
require 'singleton'
@@ -178,6 +180,17 @@ class Options
[ "--quiet", "-q", nil,
"don't show progress as we parse" ],
+ [ "--ri", "-r", nil,
+ "generate output for use by 'ri.' The files are\n" +
+ "stored in the '.rdoc' directory under your home\n"+
+ "directory unless overridden by a subsequent\n" +
+ "--op parameter, so no special privileges are needed." ],
+
+ [ "--ri-site", "-R", nil,
+ "generate output for use by 'ri.' The files are\n" +
+ "stored in a site-wide directory, making them accessible\n"+
+ "to others, so special privileges are needed." ],
+
[ "--show-hash", "-H", nil,
"A name of the form #name in a comment\n" +
"is a possible hyperlink to an instance\n" +
@@ -391,15 +404,7 @@ class Options
when "--fmt"
@generator_name = arg.downcase
- @generator = generators[@generator_name]
- if !@generator
- OptionList.error("Invalid output formatter")
- end
-
- if @generator_name == "xml"
- @all_one_file = true
- @inline_source = true
- end
+ setup_generator(generators)
when "--help"
OptionList.usage(generators.keys)
@@ -417,6 +422,11 @@ class Options
when "--include"
@rdoc_include.concat arg.split(/\s*,\s*/)
+ when "--ri", "--ri-site"
+ @generator_name = "ri"
+ @op_dir = opt == "--ri" ? RI::Paths::HOMEDIR : RI::Paths::SITEDIR
+ setup_generator(generators)
+
when "--tab-width"
begin
@tab_width = Integer(arg)
@@ -479,6 +489,19 @@ class Options
private
+ # Set up an output generator for the format in @generator_name
+ def setup_generator(generators)
+ @generator = generators[@generator_name]
+ if !@generator
+ OptionList.error("Invalid output formatter")
+ end
+
+ if @generator_name == "xml"
+ @all_one_file = true
+ @inline_source = true
+ end
+ end
+
# Check that the right version of 'dot' is available.
# Unfortuately this doesn't work correctly under Windows NT,
# so we'll bypass the test under Windows