Merge pull request #1780 from mojombo/kill-1-8
This commit is contained in:
commit
39b6fe732f
|
@ -6,7 +6,6 @@ rvm:
|
||||||
- 2.0.0
|
- 2.0.0
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
- 1.9.2
|
- 1.9.2
|
||||||
- 1.8.7
|
|
||||||
script: bundle exec rake
|
script: bundle exec rake
|
||||||
notifications:
|
notifications:
|
||||||
irc:
|
irc:
|
||||||
|
|
2
Rakefile
2
Rakefile
|
@ -84,7 +84,7 @@ end
|
||||||
#
|
#
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
||||||
if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true"
|
if ENV["TRAVIS"] == "true"
|
||||||
require 'coveralls/rake/task'
|
require 'coveralls/rake/task'
|
||||||
Coveralls::RakeTask.new
|
Coveralls::RakeTask.new
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
if RUBY_VERSION > '1.9'
|
require 'coveralls'
|
||||||
require 'coveralls'
|
Coveralls.wear_merged!
|
||||||
Coveralls.wear_merged!
|
|
||||||
end
|
|
||||||
|
|
||||||
require 'fileutils'
|
require 'fileutils'
|
||||||
require 'rr'
|
require 'rr'
|
||||||
|
@ -56,15 +54,8 @@ def file_contents(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def seconds_agnostic_datetime(datetime = Time.now)
|
def seconds_agnostic_datetime(datetime = Time.now)
|
||||||
pieces = datetime.to_s.split(" ")
|
date, time, zone = datetime.to_s.split(" ")
|
||||||
if pieces.size == 6 # Ruby 1.8.7
|
time = seconds_agnostic_time(time)
|
||||||
date = pieces[0..2].join(" ")
|
|
||||||
time = seconds_agnostic_time(pieces[3])
|
|
||||||
zone = pieces[4..5].join(" ")
|
|
||||||
else # Ruby 1.9.1 or greater
|
|
||||||
date, time, zone = pieces
|
|
||||||
time = seconds_agnostic_time(time)
|
|
||||||
end
|
|
||||||
[
|
[
|
||||||
Regexp.escape(date),
|
Regexp.escape(date),
|
||||||
"#{time}:\\d{2}",
|
"#{time}:\\d{2}",
|
||||||
|
@ -79,6 +70,3 @@ def seconds_agnostic_time(time)
|
||||||
hour, minutes, _ = time.split(":")
|
hour, minutes, _ = time.split(":")
|
||||||
"#{hour}:#{minutes}"
|
"#{hour}:#{minutes}"
|
||||||
end
|
end
|
||||||
|
|
||||||
# work around "invalid option: --format" cucumber bug (see #296)
|
|
||||||
Test::Unit.run = true if RUBY_VERSION < '1.9'
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ Gem::Specification.new do |s|
|
||||||
s.specification_version = 2 if s.respond_to? :specification_version=
|
s.specification_version = 2 if s.respond_to? :specification_version=
|
||||||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
||||||
s.rubygems_version = '1.3.5'
|
s.rubygems_version = '1.3.5'
|
||||||
|
s.required_ruby_version = '>= 1.9.2'
|
||||||
|
|
||||||
s.name = 'jekyll'
|
s.name = 'jekyll'
|
||||||
s.version = '1.4.0'
|
s.version = '1.4.0'
|
||||||
|
|
|
@ -35,8 +35,8 @@ module Jekyll
|
||||||
# Returns nothing.
|
# Returns nothing.
|
||||||
def read_yaml(base, name, opts = {})
|
def read_yaml(base, name, opts = {})
|
||||||
begin
|
begin
|
||||||
self.content = File.read_with_options(File.join(base, name),
|
self.content = File.read(File.join(base, name),
|
||||||
merged_file_read_opts(opts))
|
merged_file_read_opts(opts))
|
||||||
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m
|
||||||
self.content = $POSTMATCH
|
self.content = $POSTMATCH
|
||||||
self.data = YAML.safe_load($1)
|
self.data = YAML.safe_load($1)
|
||||||
|
|
|
@ -54,14 +54,6 @@ class Hash
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Thanks, ActiveSupport!
|
|
||||||
class Date
|
|
||||||
# Converts datetime to an appropriate format for use in XML
|
|
||||||
def xmlschema
|
|
||||||
strftime("%Y-%m-%dT%H:%M:%S%Z")
|
|
||||||
end if RUBY_VERSION < '1.9'
|
|
||||||
end
|
|
||||||
|
|
||||||
module Enumerable
|
module Enumerable
|
||||||
# Returns true if path matches against any glob pattern.
|
# Returns true if path matches against any glob pattern.
|
||||||
# Look for more detail about glob pattern in method File::fnmatch.
|
# Look for more detail about glob pattern in method File::fnmatch.
|
||||||
|
@ -69,18 +61,3 @@ module Enumerable
|
||||||
any? { |exp| File.fnmatch?(exp, e) }
|
any? { |exp| File.fnmatch?(exp, e) }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Ruby 1.8's File.read don't support option.
|
|
||||||
# read_with_options ignore optional parameter for 1.8,
|
|
||||||
# and act as alias for 1.9 or later.
|
|
||||||
class File
|
|
||||||
if RUBY_VERSION < '1.9'
|
|
||||||
def self.read_with_options(path, opts = {})
|
|
||||||
self.read(path)
|
|
||||||
end
|
|
||||||
else
|
|
||||||
def self.read_with_options(path, opts = {})
|
|
||||||
self.read(path, opts)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
|
@ -128,7 +128,7 @@ eos
|
||||||
|
|
||||||
# This method allows to modify the file content by inheriting from the class.
|
# This method allows to modify the file content by inheriting from the class.
|
||||||
def source(file, context)
|
def source(file, context)
|
||||||
File.read_with_options(file, file_read_opts(context))
|
File.read(file, file_read_opts(context))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,11 +1,9 @@
|
||||||
if RUBY_VERSION > '1.9'
|
require 'simplecov'
|
||||||
require 'simplecov'
|
require 'simplecov-gem-adapter'
|
||||||
require 'simplecov-gem-adapter'
|
SimpleCov.start('gem')
|
||||||
SimpleCov.start('gem')
|
|
||||||
|
|
||||||
require 'coveralls'
|
require 'coveralls'
|
||||||
Coveralls.wear_merged!
|
Coveralls.wear_merged!
|
||||||
end
|
|
||||||
|
|
||||||
require 'rubygems'
|
require 'rubygems'
|
||||||
require 'test/unit'
|
require 'test/unit'
|
||||||
|
@ -19,7 +17,6 @@ require 'rdiscount'
|
||||||
require 'kramdown'
|
require 'kramdown'
|
||||||
require 'redcarpet'
|
require 'redcarpet'
|
||||||
|
|
||||||
require 'redgreen' if RUBY_VERSION < '1.9'
|
|
||||||
require 'shoulda'
|
require 'shoulda'
|
||||||
require 'rr'
|
require 'rr'
|
||||||
|
|
||||||
|
|
|
@ -36,16 +36,14 @@ class TestConvertible < Test::Unit::TestCase
|
||||||
assert_no_match /undefined class\/module DoesNotExist/, out
|
assert_no_match /undefined class\/module DoesNotExist/, out
|
||||||
end
|
end
|
||||||
|
|
||||||
if RUBY_VERSION >= '1.9.2'
|
should "not parse if there is encoding error in file" do
|
||||||
should "not parse if there is encoding error in file" do
|
name = 'broken_front_matter3.erb'
|
||||||
name = 'broken_front_matter3.erb'
|
out = capture_stdout do
|
||||||
out = capture_stdout do
|
ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8')
|
||||||
ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8')
|
assert_equal({}, ret)
|
||||||
assert_equal({}, ret)
|
|
||||||
end
|
|
||||||
assert_match(/invalid byte sequence in UTF-8/, out)
|
|
||||||
assert_match(/#{File.join(@base, name)}/, out)
|
|
||||||
end
|
end
|
||||||
|
assert_match(/invalid byte sequence in UTF-8/, out)
|
||||||
|
assert_match(/#{File.join(@base, name)}/, out)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue