Skip to content

Commit 8e09447

Browse files
committed
Fix errors on Ruby 1.8.7
1 parent 6e87693 commit 8e09447

File tree

9 files changed

+24
-10
lines changed

9 files changed

+24
-10
lines changed

.autotest

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
require 'autotest/restart'
2-
require 'autotest/isolate'
32

43
Autotest.add_hook :run_command do |at|
54
at.unit_diff = 'cat'

Rakefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
4040
self.clean_globs += PARSER_FILES
4141

4242
require_ruby_version '>= 1.8.7'
43+
extra_deps << ['json', '~> 1.5']
4344
extra_dev_deps << ['racc', '~> 1.4']
4445
extra_dev_deps << ['minitest', '~> 2']
4546
extra_dev_deps << ['ZenTest', '~> 4']

TODO.rdoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Some file contains some things that might happen in RDoc, or might not
1212

1313
API changes to RDoc
1414

15+
* Remove RDoc::RDocError
1516
* RDoc::TopLevel#add_method should automatically create the appropriate method
1617
class rather than requiring one be passed in.
1718
* Remove #comment= from Context subclasses in favor of #add_comment

lib/rdoc.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class Error < RuntimeError; end
9494

9595
def self.const_missing const_name # :nodoc:
9696
if const_name.to_s == 'RDocError' then
97-
warn "RDoc::RDocError is deprecated"
97+
warn "RDoc::RDocError is deprecated and will be removed in RDoc 4"
9898
return Error
9999
end
100100

lib/rdoc/ruby_lex.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,8 +1151,10 @@ def identify_string(ltype, quoted = ltype)
11511151

11521152
str = if ltype == quoted then
11531153
ltype.dup
1154-
else
1154+
elsif RUBY_VERSION > '1.9' then
11551155
"%#{PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]}"
1156+
else
1157+
"%#{PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
11561158
end
11571159

11581160
subtype = nil

lib/rdoc/test_case.rb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,10 @@ def comment text, top_level = @top_level
4646

4747
end
4848

49+
# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since
50+
# -I paths are not expanded.
51+
$LOAD_PATH.each do |load_path|
52+
break if load_path[0] == ?/
53+
load_path.replace File.expand_path load_path
54+
end if RUBY_VERSION < '1.9'
55+

test/test_rdoc_generator_json_index.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@ def setup
99

1010
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_darkfish_#{$$}"
1111
FileUtils.mkdir_p @tmpdir
12-
Dir.chdir @tmpdir
1312

1413
@options = RDoc::Options.new
1514
@options.files = []
1615
# JsonIndex is used in conjunction with another generator
1716
@options.setup_generator 'darkfish'
17+
@options.template_dir = ''
1818
@options.op_dir = @tmpdir
1919
@options.option_parser = OptionParser.new
2020
@options.finish
@@ -48,6 +48,8 @@ def setup
4848

4949
@top_levels = [@top_level, @page].sort
5050
@klasses = [@klass, @nest_klass, @ignored]
51+
52+
Dir.chdir @tmpdir
5153
end
5254

5355
def teardown

test/test_rdoc_generator_ri.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ def setup
1010

1111
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}"
1212
FileUtils.mkdir_p @tmpdir
13-
Dir.chdir @tmpdir
1413

1514
@g = RDoc::Generator::RI.new @options
1615

@@ -29,6 +28,8 @@ def setup
2928
@klass.add_method @meth
3029
@klass.add_method @meth_bang
3130
@klass.add_attribute @attr
31+
32+
Dir.chdir @tmpdir
3233
end
3334

3435
def teardown

test/test_rdoc_markup_to_html_snippet.rb

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def setup
88
super
99

1010
@to = RDoc::Markup::ToHtmlSnippet.new 100, 100
11+
@ellipsis = @to.to_html '...'
1112
end
1213

1314
def accept_blank_line
@@ -418,7 +419,7 @@ def test_convert_limit
418419
<p>Hello
419420
<p>This is some text, it <strong>will</strong> be cut off after 100 characters
420421
and an ellipsis must follow
421-
<p>So there you ...
422+
<p>So there you #{@ellipsis}
422423
EXPECTED
423424

424425
actual = @to.convert rdoc
@@ -437,7 +438,7 @@ def test_convert_limit_2
437438

438439
expected = <<-EXPECTED
439440
<p>Outputs formatted RI data for the class or method <code>name</code>.
440-
<p>Returns true if <code>name</code> was found, false if it was ...
441+
<p>Returns true if <code>name</code> was found, false if it was #{@ellipsis}
441442
EXPECTED
442443

443444
actual = @to.convert rdoc
@@ -481,7 +482,7 @@ def test_convert_limit_in_tag
481482
@to = RDoc::Markup::ToHtmlSnippet.new 4
482483
rdoc = "* ab *c* d\n"
483484

484-
expected = "<p>ab <strong>c</strong> ...\n\n"
485+
expected = "<p>ab <strong>c</strong> #{@ellipsis}\n\n"
485486

486487
actual = @to.convert rdoc
487488

@@ -523,7 +524,7 @@ def test_convert_limit_verbatim_2
523524
expected = <<-EXPECTED
524525
<p>Extracts the class, selector and method name parts from <code>name</code>
525526
like Foo::Bar#baz.
526-
<p>NOTE: Given Foo::Bar, ...
527+
<p>NOTE: Given Foo::Bar, #{@ellipsis}
527528
EXPECTED
528529

529530
actual = @to.convert rdoc
@@ -561,7 +562,7 @@ def test_convert_limit_over
561562

562563
expected = "<p>text\n"
563564
expected.chomp!
564-
expected << " ...\n"
565+
expected << " #{@ellipsis}\n"
565566

566567
actual = @to.convert rdoc
567568

0 commit comments

Comments
 (0)