Nobuyoshi Nakada
4/25/2009 1:04:00 AM
Hi,
At Sat, 25 Apr 2009 07:37:21 +0900,
Ryan Davis wrote in [ruby-talk:334956]:
> >> rdoc version 2.4.2 has been released!
> >
> > Any plan to update the bundled rdoc in the repository?
>
> Yes. Eric and I both need to update the repo w/ stuff we've released. :/
FYI, there're a couple of fixes, specific and non-specific to
1.9, other than removing trailing spaces.
Index: lib/rdoc/parser.rb
===================================================================
--- lib/rdoc/parser.rb (revision 19930)
+++ lib/rdoc/parser.rb (working copy)
@@ -64,15 +64,9 @@ class RDoc::Parser # r20986, r23071
##
- # Shamelessly stolen from the ptools gem (since RDoc cannot depend on
- # the gem).
+ # Return _true_ if the +file+ seems like binary.
def self.binary?(file)
- s = (File.read(file, File.stat(file).blksize) || "").split(//)
-
- if s.size > 0 then
- ((s.size - s.grep(" ".."~").size) / s.size.to_f) > 0.30
- else
- false
- end
+ s = File.read(file, 1024)
+ s.count("^ -~\t\r\n").fdiv(s.size) > 0.3 || s.index("\x00") unless s.empty?
end
private_class_method :binary?
Index: lib/rdoc/ri/paths.rb
===================================================================
--- lib/rdoc/ri/paths.rb (revision 19930)
+++ lib/rdoc/ri/paths.rb (working copy)
@@ -29,4 +29,7 @@ module RDoc::RI::Paths # r23070
VERSION = RbConfig::CONFIG['ruby_version']
- base = File.join(RbConfig::CONFIG['datadir'], "ri", VERSION)
+ pre, post = RbConfig::CONFIG['RUBY_INSTALL_NAME'].split(/ruby/, 2)
+ ri = "#{pre||''}ri#{post||''}"
+ rdoc = "#{m[0]}rdoc#{m[1]}"
+ base = File.join(RbConfig::CONFIG['datadir'], ri, VERSION)
SYSDIR = File.join(base, "system")
@@ -33,10 +36,4 @@ # r21312
SITEDIR = File.join(base, "site")
- homedir = ENV['HOME'] || ENV['USERPROFILE'] || ENV['HOMEPATH']
-
- if homedir then
- HOMEDIR = File.join(homedir, ".rdoc")
- else
- HOMEDIR = nil
- end
+ HOMEDIR = (File.expand_path("~/.#{rdoc}") rescue nil)
begin
Index: test/rdoc/test_rdoc_info_formatting.rb
===================================================================
--- test/rdoc/test_rdoc_info_formatting.rb (revision 19930)
+++ test/rdoc/test_rdoc_info_formatting.rb (revision 23268)
@@ -9,5 +9,5 @@ require 'rdoc/generator/texinfo' # r21101
class TestRDocInfoFormatting < MiniTest::Unit::TestCase
def setup
- @output_dir = File.join Dir.tmpdir, "test_rdoc_info_formatting_#{$$}"
+ @output_dir = File.join Dir.mktmpdir("test_rdoc_"), "info_formatting"
@output_file = File.join @output_dir, 'rdoc.texinfo'
@@ -21,5 +21,5 @@ class TestRDocInfoFormatting < MiniTest:
def teardown
- # FileUtils.rm_rf @output_dir
+ FileUtils.rm_rf File.dirname(@output_dir)
end
Index: test/rdoc/test_rdoc_markup_to_html_crossref.rb
===================================================================
--- test/rdoc/test_rdoc_markup_to_html_crossref.rb (revision 19930)
+++ test/rdoc/test_rdoc_markup_to_html_crossref.rb (revision 23268)
@@ -85,5 +85,10 @@ class TestRDocMarkupToHtmlCrossref < Min # r22806
result.gsub!(/\n/, " ")
- assert_equal actual_expected_result, result
+ begin
+ assert_equal actual_expected_result, result
+ rescue MiniTest::Assertion => e
+ bt = caller(2)
+ raise e, [e.message, *bt.grep(/\A#{Regexp.quote(__FILE__)}:/o)].join("\n"), bt
+ end
end
--
Nobu Nakada