Permalink
Browse files

Fix errors on Ruby 1.8.7

  • Loading branch information...
1 parent 6e87693 commit 8e094474ca4d99f465a73263eb54822922fab162 @drbrain drbrain committed Sep 25, 2011
View
@@ -1,5 +1,4 @@
require 'autotest/restart'
-require 'autotest/isolate'
Autotest.add_hook :run_command do |at|
at.unit_diff = 'cat'
View
@@ -40,6 +40,7 @@ Depending on your version of ruby, you may need to install ruby rdoc/ri data:
self.clean_globs += PARSER_FILES
require_ruby_version '>= 1.8.7'
+ extra_deps << ['json', '~> 1.5']
extra_dev_deps << ['racc', '~> 1.4']
extra_dev_deps << ['minitest', '~> 2']
extra_dev_deps << ['ZenTest', '~> 4']
View
@@ -12,6 +12,7 @@ Some file contains some things that might happen in RDoc, or might not
API changes to RDoc
+* Remove RDoc::RDocError
* RDoc::TopLevel#add_method should automatically create the appropriate method
class rather than requiring one be passed in.
* Remove #comment= from Context subclasses in favor of #add_comment
View
@@ -94,7 +94,7 @@ class Error < RuntimeError; end
def self.const_missing const_name # :nodoc:
if const_name.to_s == 'RDocError' then
- warn "RDoc::RDocError is deprecated"
+ warn "RDoc::RDocError is deprecated and will be removed in RDoc 4"
return Error
end
View
@@ -1151,8 +1151,10 @@ def identify_string(ltype, quoted = ltype)
str = if ltype == quoted then
ltype.dup
- else
+ elsif RUBY_VERSION > '1.9' then
"%#{PERCENT_LTYPE.key ltype}#{PERCENT_PAREN_REV[quoted]}"
+ else
+ "%#{PERCENT_LTYPE.index ltype}#{PERCENT_PAREN_REV[quoted]}"
end
subtype = nil
View
@@ -46,3 +46,10 @@ def comment text, top_level = @top_level
end
+# This hack allows autoload to work when Dir.pwd is changed for Ruby 1.8 since
+# -I paths are not expanded.
+$LOAD_PATH.each do |load_path|
+ break if load_path[0] == ?/
+ load_path.replace File.expand_path load_path
+end if RUBY_VERSION < '1.9'
+
@@ -9,12 +9,12 @@ def setup
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_darkfish_#{$$}"
FileUtils.mkdir_p @tmpdir
- Dir.chdir @tmpdir
@options = RDoc::Options.new
@options.files = []
# JsonIndex is used in conjunction with another generator
@options.setup_generator 'darkfish'
+ @options.template_dir = ''
@options.op_dir = @tmpdir
@options.option_parser = OptionParser.new
@options.finish
@@ -48,6 +48,8 @@ def setup
@top_levels = [@top_level, @page].sort
@klasses = [@klass, @nest_klass, @ignored]
+
+ Dir.chdir @tmpdir
end
def teardown
@@ -10,7 +10,6 @@ def setup
@tmpdir = File.join Dir.tmpdir, "test_rdoc_generator_ri_#{$$}"
FileUtils.mkdir_p @tmpdir
- Dir.chdir @tmpdir
@g = RDoc::Generator::RI.new @options
@@ -29,6 +28,8 @@ def setup
@klass.add_method @meth
@klass.add_method @meth_bang
@klass.add_attribute @attr
+
+ Dir.chdir @tmpdir
end
def teardown
@@ -8,6 +8,7 @@ def setup
super
@to = RDoc::Markup::ToHtmlSnippet.new 100, 100
+ @ellipsis = @to.to_html '...'
end
def accept_blank_line
@@ -418,7 +419,7 @@ def test_convert_limit
<p>Hello
<p>This is some text, it <strong>will</strong> be cut off after 100 characters
and an ellipsis must follow
-<p>So there you ...
+<p>So there you #{@ellipsis}
EXPECTED
actual = @to.convert rdoc
@@ -437,7 +438,7 @@ def test_convert_limit_2
expected = <<-EXPECTED
<p>Outputs formatted RI data for the class or method <code>name</code>.
-<p>Returns true if <code>name</code> was found, false if it was ...
+<p>Returns true if <code>name</code> was found, false if it was #{@ellipsis}
EXPECTED
actual = @to.convert rdoc
@@ -481,7 +482,7 @@ def test_convert_limit_in_tag
@to = RDoc::Markup::ToHtmlSnippet.new 4
rdoc = "* ab *c* d\n"
- expected = "<p>ab <strong>c</strong> ...\n\n"
+ expected = "<p>ab <strong>c</strong> #{@ellipsis}\n\n"
actual = @to.convert rdoc
@@ -523,7 +524,7 @@ def test_convert_limit_verbatim_2
expected = <<-EXPECTED
<p>Extracts the class, selector and method name parts from <code>name</code>
like Foo::Bar#baz.
-<p>NOTE: Given Foo::Bar, ...
+<p>NOTE: Given Foo::Bar, #{@ellipsis}
EXPECTED
actual = @to.convert rdoc
@@ -561,7 +562,7 @@ def test_convert_limit_over
expected = "<p>text\n"
expected.chomp!
- expected << " ...\n"
+ expected << " #{@ellipsis}\n"
actual = @to.convert rdoc

0 comments on commit 8e09447

Please sign in to comment.