ruby-changes:58491
From: aycabta <ko1@a...>
Date: Tue, 29 Oct 2019 12:35:56 +0900 (JST)
Subject: [ruby-changes:58491] c8ce37d427 (master): [ruby/rdoc] Support different drive latters in include paths
https://git.ruby-lang.org/ruby.git/commit/?id=c8ce37d427 From c8ce37d4271a58132fb7fc5548e0ba7d85419152 Mon Sep 17 00:00:00 2001 From: aycabta <aycabta@g...> Date: Mon, 28 Oct 2019 01:44:09 +0900 Subject: [ruby/rdoc] Support different drive latters in include paths https://github.com/ruby/rdoc/commit/946d2592e2 diff --git a/lib/rdoc/options.rb b/lib/rdoc/options.rb index 53cc3af..43494c8 100644 --- a/lib/rdoc/options.rb +++ b/lib/rdoc/options.rb @@ -555,7 +555,13 @@ class RDoc::Options https://github.com/ruby/ruby/blob/trunk/lib/rdoc/options.rb#L555 @files << @page_dir.to_s - page_dir = @page_dir.expand_path.relative_path_from @root + page_dir = nil + begin + page_dir = @page_dir.expand_path.relative_path_from @root + rescue ArgumentError + # On Windows, sometimes crosses different drive letters. + page_dir = @page_dir.expand_path + end @page_dir = page_dir end @@ -1154,8 +1160,17 @@ Usage: #{opt.program_name} [options] [names...] https://github.com/ruby/ruby/blob/trunk/lib/rdoc/options.rb#L1160 path.reject do |item| path = Pathname.new(item).expand_path - relative = path.relative_path_from(dot).to_s - relative.start_with? '..' + is_reject = nil + relative = nil + begin + relative = path.relative_path_from(dot).to_s + rescue ArgumentError + # On Windows, sometimes crosses different drive letters. + is_reject = true + else + is_reject = relative.start_with? '..' + end + is_reject end end diff --git a/test/rdoc/test_rdoc_options.rb b/test/rdoc/test_rdoc_options.rb index bc0fc8b..140c4af 100644 --- a/test/rdoc/test_rdoc_options.rb +++ b/test/rdoc/test_rdoc_options.rb @@ -507,8 +507,14 @@ rdoc_include: https://github.com/ruby/ruby/blob/trunk/test/rdoc/test_rdoc_options.rb#L507 assert_empty out assert_empty err - expected = - Pathname(Dir.tmpdir).expand_path.relative_path_from @options.root + expected = nil + begin + expected = + Pathname(Dir.tmpdir).expand_path.relative_path_from @options.root + rescue ArgumentError + # On Windows, sometimes crosses different drive letters. + expected = Pathname(Dir.tmpdir).expand_path + end assert_equal expected, @options.page_dir assert_equal [Dir.tmpdir], @options.files -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/