* lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0

Release note: b825775647/History.rdoc (500--2016-11-05)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56586 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2016-11-05 09:18:10 +00:00
parent 0a0eb2807e
commit cdc527db34
27 changed files with 62 additions and 144 deletions

View File

@ -1,3 +1,8 @@
Sat Nov 5 18:17:08 2016 SHIBATA Hiroshi <hsbt@ruby-lang.org>
* lib/rdoc/*, test/rdoc/*: Update rdoc-5.0.0
Release note: https://github.com/rdoc/rdoc/blob/b825775647f62c5b525e9780a28ff2fbb1d5bf6f/History.rdoc#500--2016-11-05
Sat Nov 5 17:29:06 2016 Tanaka Akira <akr@fsij.org> Sat Nov 5 17:29:06 2016 Tanaka Akira <akr@fsij.org>
* lib/resolv.rb (Resolv::DNS#extract_resources): Use each_resource * lib/resolv.rb (Resolv::DNS#extract_resources): Use each_resource

View File

@ -65,7 +65,7 @@ module RDoc
## ##
# RDoc version you are using # RDoc version you are using
VERSION = '5.0.0.beta2' VERSION = '5.0.0'
## ##
# Method visibilities # Method visibilities

1
lib/rdoc/.document Normal file
View File

@ -0,0 +1 @@
*.rb

View File

@ -327,7 +327,7 @@ class RDoc::Context < RDoc::CodeObject
if full_name == 'BasicObject' then if full_name == 'BasicObject' then
superclass = nil superclass = nil
elsif full_name == 'Object' then elsif full_name == 'Object' then
superclass = defined?(::BasicObject) ? '::BasicObject' : nil superclass = '::BasicObject'
end end
# find the superclass full name # find the superclass full name
@ -1211,4 +1211,3 @@ class RDoc::Context < RDoc::CodeObject
autoload :Section, 'rdoc/context/section' autoload :Section, 'rdoc/context/section'
end end

View File

@ -49,4 +49,3 @@ module RDoc::Generator
autoload :POT, 'rdoc/generator/pot' autoload :POT, 'rdoc/generator/pot'
end end

View File

@ -1,5 +1,5 @@
<footer id="validator-badges" role="contentinfo"> <footer id="validator-badges" role="contentinfo">
<p><a href="http://validator.w3.org/check/referer">Validate</a> <p><a href="http://validator.w3.org/check/referer">Validate</a>
<p>Generated by <a href="http://docs.seattlerb.org/rdoc/">RDoc</a> <%= RDoc::VERSION %>. <p>Generated by <a href="https://rdoc.github.io/rdoc">RDoc</a> <%= RDoc::VERSION %>.
<p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>. <p>Based on <a href="http://deveiate.org/projects/Darkfish-RDoc/">Darkfish</a> by <a href="http://deveiate.org">Michael Granger</a>.
</footer> </footer>

View File

@ -521,7 +521,6 @@ class RDoc::Markdown
require 'rubygems'
require 'rdoc' require 'rdoc'
require 'rdoc/markup/to_joined_paragraph' require 'rdoc/markup/to_joined_paragraph'
require 'rdoc/markdown/entities' require 'rdoc/markdown/entities'
@ -15281,7 +15280,7 @@ class RDoc::Markdown
self.pos = _save self.pos = _save
break break
end end
@result = begin; @result = begin;
ref = [:inline, @note_order.length] ref = [:inline, @note_order.length]
@footnotes[ref] = paragraph a @footnotes[ref] = paragraph a

View File

@ -183,26 +183,14 @@ class RDoc::Markdown::Literals
return nil return nil
end end
if "".respond_to? :ord def get_byte
def get_byte if @pos >= @string_size
if @pos >= @string_size return nil
return nil
end
s = @string[@pos].ord
@pos += 1
s
end end
else
def get_byte
if @pos >= @string_size
return nil
end
s = @string[@pos] s = @string[@pos].ord
@pos += 1 @pos += 1
s s
end
end end
def parse(rule=nil) def parse(rule=nil)

View File

@ -102,8 +102,6 @@ class RDoc::Markup::PreProcess
text = text.text text = text.text
end end
encoding = text.encoding if defined?(Encoding)
# regexp helper (square brackets for optional) # regexp helper (square brackets for optional)
# $1 $2 $3 $4 $5 # $1 $2 $3 $4 $5
# [prefix][\]:directive:[spaces][param]newline # [prefix][\]:directive:[spaces][param]newline
@ -122,7 +120,7 @@ class RDoc::Markup::PreProcess
next "#{$1.strip}\n" next "#{$1.strip}\n"
end end
handle_directive $1, $3, $5, code_object, encoding, &block handle_directive $1, $3, $5, code_object, text.encoding, &block
end end
comment = text unless comment comment = text unless comment
@ -291,4 +289,3 @@ class RDoc::Markup::PreProcess
end end
end end

View File

@ -64,7 +64,6 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
# Adds bold or underline mixed with backspaces # Adds bold or underline mixed with backspaces
def convert_string string def convert_string string
return string unless string.respond_to? :chars # your ruby is lame
return string unless @in_b or @in_em return string unless @in_b or @in_em
chars = if @in_b then chars = if @in_b then
string.chars.map do |char| "#{char}\b#{char}" end string.chars.map do |char| "#{char}\b#{char}" end
@ -76,4 +75,3 @@ class RDoc::Markup::ToBs < RDoc::Markup::ToRdoc
end end
end end

View File

@ -1187,19 +1187,6 @@ Usage: #{opt.program_name} [options] [names...]
end end
end end
##
# This is compatibility code for syck
def to_yaml opts = {} # :nodoc:
return super if YAML.const_defined?(:ENGINE) and not YAML::ENGINE.syck?
YAML.quick_emit self, opts do |out|
out.map taguri, to_yaml_style do |map|
encode_with map
end
end
end
# Sets the minimum visibility of a documented method. # Sets the minimum visibility of a documented method.
# #
# Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+. # Accepts +:public+, +:protected+, +:private+, +:nodoc+, or +:all+.

View File

@ -76,25 +76,15 @@ class RDoc::Parser
s = File.read(file, 1024) or return false s = File.read(file, 1024) or return false
have_encoding = s.respond_to? :encoding
return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00") return true if s[0, 2] == Marshal.dump('')[0, 2] or s.index("\x00")
if have_encoding then mode = "r"
mode = "r" s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024.
s.sub!(/\A#!.*\n/, '') # assume shebang line isn't longer than 1024. encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1]
encoding = s[/^\s*\#\s*(?:-\*-\s*)?(?:en)?coding:\s*([^\s;]+?)(?:-\*-|[\s;])/, 1] mode = "rb:#{encoding}" if encoding
mode = "rb:#{encoding}" if encoding s = File.open(file, mode) {|f| f.gets(nil, 1024)}
s = File.open(file, mode) {|f| f.gets(nil, 1024)}
not s.valid_encoding? not s.valid_encoding?
else
if 0.respond_to? :fdiv then
s.count("\x00-\x7F", "^ -~\t\r\n").fdiv(s.size) > 0.3
else # HACK 1.8.6
(s.count("\x00-\x7F", "^ -~\t\r\n").to_f / s.size) > 0.3
end
end
end end
## ##
@ -308,4 +298,3 @@ require 'rdoc/parser/changelog'
require 'rdoc/parser/markdown' require 'rdoc/parser/markdown'
require 'rdoc/parser/rd' require 'rdoc/parser/rd'
require 'rdoc/parser/ruby' require 'rdoc/parser/ruby'

File diff suppressed because one or more lines are too long

View File

@ -161,15 +161,9 @@ class RDoc::RDoc
RDoc.load_yaml RDoc.load_yaml
parse_error = if Object.const_defined? :Psych then
Psych::SyntaxError
else
ArgumentError
end
begin begin
options = YAML.load_file '.rdoc_options' options = YAML.load_file '.rdoc_options'
rescue *parse_error rescue Psych::SyntaxError
end end
raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless raise RDoc::Error, "#{options_file} is not a valid rdoc options file" unless
@ -417,6 +411,7 @@ The internal error was:
return [] if file_list.empty? return [] if file_list.empty?
original_options = @options.dup
@stats.begin_adding @stats.begin_adding
file_info = file_list.map do |filename| file_info = file_list.map do |filename|
@ -425,6 +420,7 @@ The internal error was:
end.compact end.compact
@stats.done_adding @stats.done_adding
@options = original_options
file_info file_info
end end
@ -479,7 +475,7 @@ The internal error was:
@last_modified = setup_output_dir @options.op_dir, @options.force_update @last_modified = setup_output_dir @options.op_dir, @options.force_update
end end
@store.encoding = @options.encoding if @options.respond_to? :encoding @store.encoding = @options.encoding
@store.dry_run = @options.dry_run @store.dry_run = @options.dry_run
@store.main = @options.main_page @store.main = @options.main_page
@store.title = @options.title @store.title = @options.title

View File

@ -1428,7 +1428,7 @@ The ri pager can be set with the 'RI_PAGER' environment variable or the
def setup_pager def setup_pager
return if @use_stdout return if @use_stdout
jruby = Object.const_defined?(:RUBY_ENGINE) && RUBY_ENGINE == 'jruby' jruby = RUBY_ENGINE == 'jruby'
pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more'] pagers = [ENV['RI_PAGER'], ENV['PAGER'], 'pager', 'less', 'more']

View File

@ -853,11 +853,7 @@ class RDoc::RubyLex
end end
end end
IDENT_RE = if defined? Encoding then IDENT_RE = eval '/[\w\u{0080}-\u{FFFFF}]/u'
eval '/[\w\u{0080}-\u{FFFFF}]/u' # 1.8 can't parse \u{}
else
/[\w\x80-\xFF]/
end
def identify_identifier def identify_identifier
token = "" token = ""

View File

@ -153,13 +153,7 @@ class RDoc::RubygemsHook
options = nil options = nil
args = @spec.rdoc_options args = @spec.rdoc_options
args.concat @spec.source_paths
if @spec.respond_to? :source_paths then
args.concat @spec.source_paths
else
args.concat @spec.require_paths
end
args.concat @spec.extra_rdoc_files args.concat @spec.extra_rdoc_files
case config_args = Gem.configuration[:rdoc] case config_args = Gem.configuration[:rdoc]
@ -183,7 +177,7 @@ class RDoc::RubygemsHook
@rdoc.options = options @rdoc.options = options
store = RDoc::Store.new store = RDoc::Store.new
store.encoding = options.encoding if options.respond_to? :encoding store.encoding = options.encoding
store.dry_run = options.dry_run store.dry_run = options.dry_run
store.main = options.main_page store.main = options.main_page
store.title = options.title store.title = options.title

View File

@ -1,8 +1,5 @@
# frozen_string_literal: false # frozen_string_literal: false
begin require 'io/console/size'
require 'io/console/size'
rescue LoadError
end
## ##
# Stats printer that prints just the files being documented with a progress # Stats printer that prints just the files being documented with a progress
@ -26,11 +23,7 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
# Print a progress bar, but make sure it fits on a single line. Filename # Print a progress bar, but make sure it fits on a single line. Filename
# will be truncated if necessary. # will be truncated if necessary.
terminal_width = if defined?(IO) && IO.respond_to?(:console_size) terminal_width = IO.console_size[1].to_i.nonzero? || 80
IO.console_size[1].to_i.nonzero? || 80
else
80
end
max_filename_size = terminal_width - progress_bar.size max_filename_size = terminal_width - progress_bar.size
if filename.size > max_filename_size then if filename.size > max_filename_size then
@ -57,4 +50,3 @@ class RDoc::Stats::Normal < RDoc::Stats::Quiet
end end
end end

View File

@ -679,12 +679,7 @@ class RDoc::Store
method_name =~ /#(.*)/ method_name =~ /#(.*)/
method_type = $1 ? 'i' : 'c' method_type = $1 ? 'i' : 'c'
method_name = $1 if $1 method_name = $1 if $1
method_name = method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
method_name = if ''.respond_to? :ord then
method_name.gsub(/\W/) { "%%%02x" % $&[0].ord }
else
method_name.gsub(/\W/) { "%%%02x" % $&[0] }
end
File.join class_path(klass_name), "#{method_name}-#{method_type}.ri" File.join class_path(klass_name), "#{method_name}-#{method_type}.ri"
end end

View File

@ -141,7 +141,7 @@ class RDoc::TestCase < MiniTest::Unit::TestCase
def mu_pp obj # :nodoc: def mu_pp obj # :nodoc:
s = '' s = ''
s = PP.pp obj, s s = PP.pp obj, s
s = s.force_encoding Encoding.default_external if defined? Encoding s = s.force_encoding Encoding.default_external
s.chomp s.chomp
end end

View File

@ -8,9 +8,6 @@ class TestRDocContext < XrefTestCase
@context = RDoc::Context.new @context = RDoc::Context.new
@context.store = @store @context.store = @store
@enumerator = # 1.8 vs 1.9
Object.const_defined?(:Enumerator) ? Enumerator : Enumerable::Enumerator
end end
def test_initialize def test_initialize
@ -118,8 +115,6 @@ class TestRDocContext < XrefTestCase
end end
def test_add_class_basic_object def test_add_class_basic_object
skip 'BasicObject is 1.9 only' unless defined?(BasicObject)
@xref_data.add_class RDoc::NormalClass, 'BasicObject' @xref_data.add_class RDoc::NormalClass, 'BasicObject'
basic = @xref_data.find_module_named 'BasicObject' basic = @xref_data.find_module_named 'BasicObject'
@ -134,13 +129,11 @@ class TestRDocContext < XrefTestCase
end end
def test_add_class_object def test_add_class_object
root_class = defined?(BasicObject) ? 'BasicObject' : nil
@xref_data.add_class RDoc::NormalClass, 'Object' @xref_data.add_class RDoc::NormalClass, 'Object'
object = @xref_data.find_module_named 'Object' object = @xref_data.find_module_named 'Object'
assert_equal root_class, object.superclass assert_equal 'BasicObject', object.superclass
@c1.add_class RDoc::NormalClass, 'Object' @c1.add_class RDoc::NormalClass, 'Object'
@ -457,7 +450,7 @@ class TestRDocContext < XrefTestCase
end end
def test_each_method_enumerator def test_each_method_enumerator
assert_kind_of @enumerator, @c1.each_method assert_kind_of Enumerator, @c1.each_method
end end
def test_each_section def test_each_section
@ -489,7 +482,7 @@ class TestRDocContext < XrefTestCase
end end
def test_each_section_enumerator def test_each_section_enumerator
assert_kind_of @enumerator, @c1.each_section assert_kind_of Enumerator, @c1.each_section
end end
def test_find_attribute_named def test_find_attribute_named
@ -899,4 +892,3 @@ class TestRDocContext < XrefTestCase
end end
end end

View File

@ -495,7 +495,7 @@ be guessed, raises an error if +name+ couldn't be guessed.
= \RDoc - Ruby Documentation System = \RDoc - Ruby Documentation System
* {RDoc Project Page}[https://github.com/rdoc/rdoc/] * {RDoc Project Page}[https://github.com/rdoc/rdoc/]
* {RDoc Documentation}[http://docs.seattlerb.org/rdoc] * {RDoc Documentation}[https://rdoc.github.io/rdoc]
* {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues] * {RDoc Bug Tracker}[https://github.com/rdoc/rdoc/issues]
== DESCRIPTION: == DESCRIPTION:
@ -709,4 +709,3 @@ This routine modifies its +comment+ parameter.
end end
end end

View File

@ -119,7 +119,7 @@ class TestRDocParser < RDoc::TestCase
end end
io io
end end
tf.close! if tf.respond_to? :close! tf.close!
end end
def test_class_for_modeline def test_class_for_modeline

View File

@ -165,7 +165,7 @@ class TestRDocRdBlockParser < RDoc::TestCase
assert_equal expected, parse(str) assert_equal expected, parse(str)
io io
end end
tf.close! if tf.respond_to? :close! tf.close!
end end
def test_parse_heading def test_parse_heading

View File

@ -133,7 +133,7 @@ class TestRDocRDoc < RDoc::TestCase
end end
def test_normalized_file_list_non_file_directory def test_normalized_file_list_non_file_directory
dev = defined?(File::NULL) ? File::NULL : '/dev/stdin' dev = File::NULL
skip "#{dev} is not a character special" unless skip "#{dev} is not a character special" unless
File.chardev? dev File.chardev? dev
@ -261,7 +261,7 @@ class TestRDocRDoc < RDoc::TestCase
assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding assert_equal Encoding::ISO_8859_1, top_level.absolute_name.encoding
io io
end end
tf.close! if tf.respond_to? :close! tf.close!
end end
def test_parse_file_forbidden def test_parse_file_forbidden
@ -290,7 +290,7 @@ class TestRDocRDoc < RDoc::TestCase
end end
io io
end end
tf.close! if tf.respond_to? :close! tf.close!
end end
def test_remove_unparseable def test_remove_unparseable
@ -398,7 +398,7 @@ class TestRDocRDoc < RDoc::TestCase
e.message) e.message)
tempfile tempfile
end end
tf.close! if tf.respond_to? :close! tf.close!
end end
def test_setup_output_dir_exists_not_rdoc def test_setup_output_dir_exists_not_rdoc

View File

@ -7,9 +7,6 @@ class TestRDocRubygemsHook < Gem::TestCase
def setup def setup
super super
skip 'requires RubyGems 1.9+' unless
Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.9')
@a = util_spec 'a', 2 do |s| @a = util_spec 'a', 2 do |s|
s.rdoc_options = %w[--main MyTitle] s.rdoc_options = %w[--main MyTitle]
s.extra_rdoc_files = %w[README] s.extra_rdoc_files = %w[README]
@ -134,7 +131,6 @@ class TestRDocRubygemsHook < Gem::TestCase
end end
def test_generate_default_gem def test_generate_default_gem
skip 'RubyGems 2 required' unless @a.respond_to? :default_gem?
@a.loaded_from = @a.loaded_from =
File.join Gem::Specification.default_specifications_dir, 'a.gemspec' File.join Gem::Specification.default_specifications_dir, 'a.gemspec'

View File

@ -3,7 +3,7 @@ require File.expand_path '../xref_test_case', __FILE__
class TestRDocStore < XrefTestCase class TestRDocStore < XrefTestCase
OBJECT_ANCESTORS = defined?(::BasicObject) ? %w[BasicObject] : [] OBJECT_ANCESTORS = %w[BasicObject]
def setup def setup
super super
@ -631,7 +631,7 @@ class TestRDocStore < XrefTestCase
:title => nil, :title => nil,
} }
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject) expected[:ancestors]['Object'] = %w[BasicObject]
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
cache = Marshal.load io.read cache = Marshal.load io.read
@ -699,7 +699,7 @@ class TestRDocStore < XrefTestCase
:title => 'title', :title => 'title',
} }
expected[:ancestors]['Object'] = %w[BasicObject] if defined?(::BasicObject) expected[:ancestors]['Object'] = %w[BasicObject]
open File.join(@tmpdir, 'cache.ri'), 'rb' do |io| open File.join(@tmpdir, 'cache.ri'), 'rb' do |io|
cache = Marshal.load io.read cache = Marshal.load io.read