summaryrefslogtreecommitdiff
path: root/lib/rdoc/options.rb
diff options
context:
space:
mode:
authordave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 05:44:25 +0000
committerdave <dave@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-16 05:44:25 +0000
commitc5bbcadbe64477433a243be191c41010c7ae10dc (patch)
tree0d09db2cbe31c84eac3c29575e7008c9d7a6d57b /lib/rdoc/options.rb
parentdcd30a1236cdb2e06b6dd1a74a4c0a0c29549be6 (diff)
Initial load of support for ri/rdoc integration
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5199 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 fe75b10ce8..36b82eab7d 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