aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-31 19:06:21 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-07-31 19:06:21 +0000
commit835c555f7f137746eb6f7cd32bd05a386852fdbe (patch)
tree67e96fe81b8fec7c1902afcd2590f0903b34a63d
parent3d562b6873384098fb8e7ec375f36f3bf246b6c9 (diff)
downloadruby-835c555f7f137746eb6f7cd32bd05a386852fdbe.tar.gz
options.rb: include root for out-place build
* lib/rdoc/options.rb (RDoc#finish): include root path in include paths, to work in another directory than the source directory. [ruby-core:56282] [Bug #8712] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/rdoc/options.rb2
-rw-r--r--test/rdoc/test_rdoc_options.rb1
-rw-r--r--test/rdoc/test_rdoc_rdoc.rb20
4 files changed, 28 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ddd1eefc5..f5118c714b 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,8 @@
-Thu Aug 1 04:05:06 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+Thu Aug 1 04:06:17 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/rdoc/options.rb (RDoc#finish): include root path in include
+ paths, to work in another directory than the source directory.
+ [ruby-core:56282] [Bug #8712]
* test/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#setup):
fix input_file_name, as the test script is not pre-processed.
diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb
index 7be43ca776..9a9d99d3df 100644
--- a/lib/rdoc/options.rb
+++ b/lib/rdoc/options.rb
@@ -466,6 +466,8 @@ class RDoc::Options
@op_dir ||= 'doc'
@rdoc_include << "." if @rdoc_include.empty?
+ root = @root.to_path
+ @rdoc_include << root unless @rdoc_include.include?(root)
if @exclude.nil? or Regexp === @exclude then
# done, #finish is being re-run
diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb
index 5d7135c795..e72489d307 100644
--- a/test/rdoc/test_rdoc_options.rb
+++ b/test/rdoc/test_rdoc_options.rb
@@ -479,6 +479,7 @@ rdoc_include:
assert_empty err
assert_equal Pathname(Dir.tmpdir), @options.root
+ assert_includes @options.rdoc_include, @options.root.to_path
end
def test_parse_template
diff --git a/test/rdoc/test_rdoc_rdoc.rb b/test/rdoc/test_rdoc_rdoc.rb
index 28b6a2bb4d..9a13569f01 100644
--- a/test/rdoc/test_rdoc_rdoc.rb
+++ b/test/rdoc/test_rdoc_rdoc.rb
@@ -162,6 +162,26 @@ class TestRDocRDoc < RDoc::TestCase
end
end
+ def test_parse_file_include_root
+ @rdoc.store = RDoc::Store.new
+
+ top_level = nil
+ temp_dir do |dir|
+ @rdoc.options.parse %W[--root #{File.dirname(__FILE__)}]
+
+ open 'include.txt', 'w' do |io|
+ io.puts ':include: test.txt'
+ end
+
+ out, err = capture_io do
+ top_level = @rdoc.parse_file 'include.txt'
+ end
+ assert_empty out
+ assert_empty err
+ end
+ assert_equal "test file", top_level.comment.text
+ end
+
def test_parse_file_page_dir
@rdoc.store = RDoc::Store.new