1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2013-07-31 19:06:21 +00:00
parent 3d562b6873
commit 835c555f7f
4 changed files with 28 additions and 1 deletions

View file

@ -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): * test/test_rdoc_markup_pre_process.rb (TestRDocMarkupPreProcess#setup):
fix input_file_name, as the test script is not pre-processed. fix input_file_name, as the test script is not pre-processed.

View file

@ -466,6 +466,8 @@ class RDoc::Options
@op_dir ||= 'doc' @op_dir ||= 'doc'
@rdoc_include << "." if @rdoc_include.empty? @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 if @exclude.nil? or Regexp === @exclude then
# done, #finish is being re-run # done, #finish is being re-run

View file

@ -479,6 +479,7 @@ rdoc_include:
assert_empty err assert_empty err
assert_equal Pathname(Dir.tmpdir), @options.root assert_equal Pathname(Dir.tmpdir), @options.root
assert_includes @options.rdoc_include, @options.root.to_path
end end
def test_parse_template def test_parse_template

View file

@ -162,6 +162,26 @@ class TestRDocRDoc < RDoc::TestCase
end end
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 def test_parse_file_page_dir
@rdoc.store = RDoc::Store.new @rdoc.store = RDoc::Store.new