[前][次][番号順一覧][スレッド一覧]

ruby-changes:30248

From: nobu <ko1@a...>
Date: Thu, 1 Aug 2013 04:06:31 +0900 (JST)
Subject: [ruby-changes:30248] nobu:r42300 (trunk): options.rb: include root for out-place build

nobu	2013-08-01 04:06:21 +0900 (Thu, 01 Aug 2013)

  New Revision: 42300

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=42300

  Log:
    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]

  Modified files:
    trunk/ChangeLog
    trunk/lib/rdoc/options.rb
    trunk/test/rdoc/test_rdoc_options.rb
    trunk/test/rdoc/test_rdoc_rdoc.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 42299)
+++ ChangeLog	(revision 42300)
@@ -1,4 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
-Thu Aug  1 04:05:06 2013  Nobuyoshi Nakada  <nobu@r...>
+Thu Aug  1 04:06:17 2013  Nobuyoshi Nakada  <nobu@r...>
+
+	* 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.
Index: lib/rdoc/options.rb
===================================================================
--- lib/rdoc/options.rb	(revision 42299)
+++ lib/rdoc/options.rb	(revision 42300)
@@ -466,6 +466,8 @@ class RDoc::Options https://github.com/ruby/ruby/blob/trunk/lib/rdoc/options.rb#L466
     @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
Index: test/rdoc/test_rdoc_rdoc.rb
===================================================================
--- test/rdoc/test_rdoc_rdoc.rb	(revision 42299)
+++ test/rdoc/test_rdoc_rdoc.rb	(revision 42300)
@@ -162,6 +162,26 @@ class TestRDocRDoc < RDoc::TestCase https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_rdoc.rb#L162
     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
 
Index: test/rdoc/test_rdoc_options.rb
===================================================================
--- test/rdoc/test_rdoc_options.rb	(revision 42299)
+++ test/rdoc/test_rdoc_options.rb	(revision 42300)
@@ -479,6 +479,7 @@ rdoc_include: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_options.rb#L479
     assert_empty err
 
     assert_equal Pathname(Dir.tmpdir), @options.root
+    assert_includes @options.rdoc_include, @options.root.to_path
   end
 
   def test_parse_template

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]