summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--etc/CodeRay.tmproj2
-rw-r--r--lib/coderay/encoders/json.rb2
-rw-r--r--lib/coderay/helpers/plugin.rb2
-rw-r--r--lib/coderay/scanners/php.rb2
-rw-r--r--rake_tasks/documentation.rake8
-rw-r--r--rake_tasks/test.rake10
-rw-r--r--test/unit/file_type.rb4
-rw-r--r--test/unit/lines_of_code.rb24
8 files changed, 28 insertions, 26 deletions
diff --git a/etc/CodeRay.tmproj b/etc/CodeRay.tmproj
index aef1391..cbf492b 100644
--- a/etc/CodeRay.tmproj
+++ b/etc/CodeRay.tmproj
@@ -106,7 +106,7 @@
<key>filename</key>
<string>../Rakefile</string>
<key>lastUsed</key>
- <date>2011-05-23T23:35:00Z</date>
+ <date>2011-07-08T15:25:14Z</date>
</dict>
<dict>
<key>expanded</key>
diff --git a/lib/coderay/encoders/json.rb b/lib/coderay/encoders/json.rb
index 9da3238..ccad554 100644
--- a/lib/coderay/encoders/json.rb
+++ b/lib/coderay/encoders/json.rb
@@ -22,7 +22,7 @@ module Encoders
rescue LoadError
begin
require 'rubygems'
- gem "json#{'-jruby' if defined? JRUBY_VERSION}"
+ gem "json"
require 'json'
rescue LoadError
$stderr.puts "The JSON encoder needs the JSON library.\n" \
diff --git a/lib/coderay/helpers/plugin.rb b/lib/coderay/helpers/plugin.rb
index b0dda0c..8a8e149 100644
--- a/lib/coderay/helpers/plugin.rb
+++ b/lib/coderay/helpers/plugin.rb
@@ -271,7 +271,7 @@ module CodeRay
def aliases
plugin_host.load_plugin_map
- plugin_host.plugin_hash.inject [] do |aliases, (key, value)|
+ plugin_host.plugin_hash.inject [] do |aliases, (key, _)|
aliases << key if plugin_host[key] == self
aliases
end
diff --git a/lib/coderay/scanners/php.rb b/lib/coderay/scanners/php.rb
index ea9a8c8..8ec1196 100644
--- a/lib/coderay/scanners/php.rb
+++ b/lib/coderay/scanners/php.rb
@@ -354,7 +354,7 @@ module Scanners
elsif match = scan(/<<<(?:(#{RE::IDENTIFIER})|"(#{RE::IDENTIFIER})"|'(#{RE::IDENTIFIER})')/o)
encoder.begin_group :string
- warn 'heredoc in heredoc?' if heredoc_delimiter
+ # warn 'heredoc in heredoc?' if heredoc_delimiter
heredoc_delimiter = Regexp.escape(self[1] || self[2] || self[3])
encoder.text_token match, :delimiter
states.push self[3] ? :sqstring : :dqstring
diff --git a/rake_tasks/documentation.rake b/rake_tasks/documentation.rake
index 16142fd..796e281 100644
--- a/rake_tasks/documentation.rake
+++ b/rake_tasks/documentation.rake
@@ -1,5 +1,9 @@
-gem 'rdoc' if defined? gem
-require 'rdoc/task'
+if RUBY_VERSION >= '1.8.7'
+ gem 'rdoc' if defined? gem
+ require 'rdoc/task'
+else
+ require 'rake/rdoctask'
+end
desc 'Generate documentation for CodeRay'
Rake::RDocTask.new :doc do |rd|
diff --git a/rake_tasks/test.rake b/rake_tasks/test.rake
index 203bbf6..1140062 100644
--- a/rake_tasks/test.rake
+++ b/rake_tasks/test.rake
@@ -52,10 +52,16 @@ namespace :test do
desc 'test the CodeRay executable'
task :exe do
- ruby './test/executable/suite.rb'
+ if RUBY_VERSION >= '1.8.7'
+ ruby './test/executable/suite.rb'
+ else
+ puts
+ puts "Can't run executable tests because shoulda-context requires Ruby 1.8.7+."
+ puts "Skipping."
+ end
end
end
-task :test => %w( test:functional test:exe test:units )
+task :test => %w(test:functional test:units test:exe)
task :samples => 'test:samples' \ No newline at end of file
diff --git a/test/unit/file_type.rb b/test/unit/file_type.rb
index dfd5b17..d62a006 100644
--- a/test/unit/file_type.rb
+++ b/test/unit/file_type.rb
@@ -20,10 +20,6 @@ class FileTypeTests < Test::Unit::TestCase
end
def test_block_supersedes_default_warning
- if defined? JRUBY_VERSION
- $stderr.puts 'Skipped test because of JRUBY bug.'
- return
- end
stderr, fake_stderr = $stderr, Object.new
begin
$err = ''
diff --git a/test/unit/lines_of_code.rb b/test/unit/lines_of_code.rb
index a76fed6..4231d5a 100644
--- a/test/unit/lines_of_code.rb
+++ b/test/unit/lines_of_code.rb
@@ -39,21 +39,17 @@ puts "Hello world!"
tokens.concat ["\n", :space]
tokens.concat ["Hello\n", :comment]
- if defined? JRUBY_VERSION
- $stderr.puts 'Skipped test because of JRUBY bug.'
- else
- stderr, fake_stderr = $stderr, Object.new
- begin
- $err = ''
- def fake_stderr.write x
- $err << x
- end
- $stderr = fake_stderr
- assert_equal 1, tokens.lines_of_code
- assert_equal "Tokens have no associated scanner, counting all nonempty lines.\n", $err
- ensure
- $stderr = stderr
+ stderr, fake_stderr = $stderr, Object.new
+ begin
+ $err = ''
+ def fake_stderr.write x
+ $err << x
end
+ $stderr = fake_stderr
+ assert_equal 1, tokens.lines_of_code
+ assert_equal "Tokens have no associated scanner, counting all nonempty lines.\n", $err
+ ensure
+ $stderr = stderr
end
tokens.scanner = ScannerMockup.new