From c5bbcadbe64477433a243be191c41010c7ae10dc Mon Sep 17 00:00:00 2001 From: dave Date: Tue, 16 Dec 2003 05:44:25 +0000 Subject: 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 --- lib/rdoc/options.rb | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) (limited to 'lib/rdoc/options.rb') 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 -- cgit v1.2.3