summaryrefslogtreecommitdiff
path: root/lib/rdoc/options.rb
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 07:44:56 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-11 07:44:56 +0000
commitb65b75bf2ce955dc8f5fb589732927acc8b72c29 (patch)
tree0e33d09bc3aeeef5c35dbf6fc404d7ab4658b9e8 /lib/rdoc/options.rb
parentd5ba73e0d9fd2fb9d1c787247c8755fa8ccc8404 (diff)
* lib/rdoc/options.rb: Added --page-dir option for moving pages in
doc/ to the top-level. * lib/rdoc/rdoc.rb: ditto. * test/rdoc/test_rdoc_options.rb: Test for the above. * test/rdoc/test_rdoc_rdoc.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rdoc/options.rb')
-rw-r--r--lib/rdoc/options.rb37
1 files changed, 36 insertions, 1 deletions
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 57d457a8303..7be43ca776b 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -229,6 +229,12 @@ class RDoc::Options
attr_accessor :option_parser
##
+ # Directory where guides, FAQ, and other pages not associated with a class
+ # live. You may leave this unset if these are at the root of your project.
+
+ attr_accessor :page_dir
+
+ ##
# Is RDoc in pipe mode?
attr_accessor :pipe
@@ -317,6 +323,7 @@ class RDoc::Options
@markup = 'rdoc'
@coverage_report = false
@op_dir = nil
+ @page_dir = nil
@pipe = false
@rdoc_include = []
@root = Pathname(Dir.pwd)
@@ -468,6 +475,8 @@ class RDoc::Options
@exclude = Regexp.new(@exclude.join("|"))
end
+ finish_page_dir
+
check_files
# If no template was specified, use the default template for the output
@@ -482,6 +491,20 @@ class RDoc::Options
end
##
+ # Fixes the page_dir to be relative to the root_dir and adds the page_dir to
+ # the files list.
+
+ def finish_page_dir
+ return unless @page_dir
+
+ @files << @page_dir.to_s
+
+ page_dir = @page_dir.expand_path.relative_path_from @root
+
+ @page_dir = page_dir
+ end
+
+ ##
# Returns a properly-space list of generators and their descriptions.
def generator_descriptions
@@ -665,7 +688,7 @@ Usage: #{opt.program_name} [options] [names...]
opt.separator nil
- opt.on("--pipe",
+ opt.on("--pipe", "-p",
"Convert RDoc on stdin to HTML") do
@pipe = true
end
@@ -709,6 +732,18 @@ Usage: #{opt.program_name} [options] [names...]
end
opt.separator nil
+
+ opt.on("--page-dir=DIR", Directory,
+ "Directory where guides, your FAQ or",
+ "other pages not associated with a class",
+ "live. Set this when you don't store",
+ "such files at your project root.",
+ "NOTE: Do not use the same file name in",
+ "the page dir and the root of your project") do |page_dir|
+ @page_dir = Pathname(page_dir)
+ end
+
+ opt.separator nil
opt.separator "Common generator options:"
opt.separator nil