Ruby 1.9 compatibility
* Adds current directory to load path for tests because 1.9 does not * Aliases String#lines to String#to_a under 1.8 to match 1.9 behavior * Sets encoding magic comment in test file with characters outside ascii * Require 'ostruct' explicitly This depends on a patch to Grit to have full functionality through the whole stack.
This commit is contained in:
@@ -47,7 +47,7 @@ task :default => :test
|
|||||||
|
|
||||||
require 'rake/testtask'
|
require 'rake/testtask'
|
||||||
Rake::TestTask.new(:test) do |test|
|
Rake::TestTask.new(:test) do |test|
|
||||||
test.libs << 'lib' << 'test'
|
test.libs << 'lib' << 'test' << '.'
|
||||||
test.pattern = 'test/**/test_*.rb'
|
test.pattern = 'test/**/test_*.rb'
|
||||||
test.verbose = true
|
test.verbose = true
|
||||||
end
|
end
|
||||||
@@ -143,4 +143,4 @@ task :validate do
|
|||||||
puts "A `VERSION` file at root level violates Gem best practices."
|
puts "A `VERSION` file at root level violates Gem best practices."
|
||||||
exit!
|
exit!
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,15 @@
|
|||||||
# stdlib
|
# stdlib
|
||||||
require 'digest/md5'
|
require 'digest/md5'
|
||||||
|
require 'ostruct'
|
||||||
|
|
||||||
# external
|
# external
|
||||||
require 'grit'
|
require 'grit'
|
||||||
require 'github/markup'
|
require 'github/markup'
|
||||||
require 'sanitize'
|
require 'sanitize'
|
||||||
|
|
||||||
|
# ruby 1.8 compatibility
|
||||||
|
require 'gollum/ruby1.8'
|
||||||
|
|
||||||
# internal
|
# internal
|
||||||
require 'gollum/pagination'
|
require 'gollum/pagination'
|
||||||
require 'gollum/wiki'
|
require 'gollum/wiki'
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ module Gollum
|
|||||||
@codemap.each do |id, spec|
|
@codemap.each do |id, spec|
|
||||||
lang = spec[:lang]
|
lang = spec[:lang]
|
||||||
code = spec[:code]
|
code = spec[:code]
|
||||||
if code.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
|
if code.lines.all? { |line| line =~ /\A\r?\n\Z/ || line =~ /^( |\t)/ }
|
||||||
code.gsub!(/^( |\t)/m, '')
|
code.gsub!(/^( |\t)/m, '')
|
||||||
end
|
end
|
||||||
data.gsub!(id, Gollum::Albino.new(code, lang).colorize)
|
data.gsub!(id, Gollum::Albino.new(code, lang).colorize)
|
||||||
@@ -328,4 +328,4 @@ module Gollum
|
|||||||
data
|
data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
class String
|
||||||
|
alias :lines :to_a if defined?(RUBY_VERSION) && RUBY_VERSION < '1.9'
|
||||||
|
end
|
||||||
+1
-1
@@ -332,4 +332,4 @@ module Gollum
|
|||||||
map
|
map
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
+2
-1
@@ -1,3 +1,4 @@
|
|||||||
|
# ~*~ encoding: utf-8 ~*~
|
||||||
require File.join(File.dirname(__FILE__), *%w[helper])
|
require File.join(File.dirname(__FILE__), *%w[helper])
|
||||||
|
|
||||||
context "Page" do
|
context "Page" do
|
||||||
@@ -109,4 +110,4 @@ context "Page" do
|
|||||||
footer = @wiki.page("_Footer")
|
footer = @wiki.page("_Footer")
|
||||||
assert_nil footer.footer
|
assert_nil footer.footer
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user