From c5ff3fec391f6c8a770072992b7b52e26301be4c Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 6 Dec 2013 01:42:04 -0500 Subject: [PATCH 1/8] Remove 1.8.7 from Travis build spec --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index b1aacd13..da5e0918 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ rvm: - 2.0.0 - 1.9.3 - 1.9.2 - - 1.8.7 script: bundle exec rake notifications: irc: From 96ecfb30efdedfbac8de452e2d0ec28cf1ba195f Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 6 Dec 2013 01:42:23 -0500 Subject: [PATCH 2/8] Require Ruby version >= 1.9.2 in gemspec --- jekyll.gemspec | 1 + 1 file changed, 1 insertion(+) diff --git a/jekyll.gemspec b/jekyll.gemspec index 729b46b1..558e3cd7 100644 --- a/jekyll.gemspec +++ b/jekyll.gemspec @@ -2,6 +2,7 @@ Gem::Specification.new do |s| 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.rubygems_version = '1.3.5' + s.required_ruby_version = '>= 1.9.2' s.name = 'jekyll' s.version = '1.3.1' From 1297ed5c1d6db68754bdbe3ceac2ec433530cf6d Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Fri, 6 Dec 2013 01:42:37 -0500 Subject: [PATCH 3/8] Remove weird 1.8.7 workarounds in features env --- features/support/env.rb | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/features/support/env.rb b/features/support/env.rb index 0d207b41..90f6546c 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,7 +1,5 @@ -if RUBY_VERSION > '1.9' - require 'coveralls' - Coveralls.wear_merged! -end +require 'coveralls' +Coveralls.wear_merged! require 'fileutils' require 'rr' @@ -47,15 +45,8 @@ def file_contents(path) end def seconds_agnostic_datetime(datetime = Time.now) - pieces = datetime.to_s.split(" ") - if pieces.size == 6 # Ruby 1.8.7 - 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 + date, time, zone = datetime.to_s.split(" ") + time = seconds_agnostic_time(time) [ Regexp.escape(date), "#{time}:\\d{2}", @@ -70,6 +61,3 @@ def seconds_agnostic_time(time) hour, minutes, _ = time.split(":") "#{hour}:#{minutes}" end - -# work around "invalid option: --format" cucumber bug (see #296) -Test::Unit.run = true if RUBY_VERSION < '1.9' From 6ad0be7c6eb9567d505b35e4d4c76f2d26a50816 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Dec 2013 00:47:23 -0500 Subject: [PATCH 4/8] Don't check for >= 1.9 in Rakefile --- Rakefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Rakefile b/Rakefile index d76ec053..3af30fdf 100644 --- a/Rakefile +++ b/Rakefile @@ -84,7 +84,7 @@ end # ############################################################################# -if RUBY_VERSION > '1.9' && ENV["TRAVIS"] == "true" +if ENV["TRAVIS"] == "true" require 'coveralls/rake/task' Coveralls::RakeTask.new From d130fd13dc11e89387aad69b8202d80431319a05 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Dec 2013 00:47:44 -0500 Subject: [PATCH 5/8] Remove Ruby <1.9 core extensions --- lib/jekyll/core_ext.rb | 18 ++---------------- 1 file changed, 2 insertions(+), 16 deletions(-) diff --git a/lib/jekyll/core_ext.rb b/lib/jekyll/core_ext.rb index 54f7c9d5..c71c72f5 100644 --- a/lib/jekyll/core_ext.rb +++ b/lib/jekyll/core_ext.rb @@ -54,14 +54,6 @@ class Hash 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 # Returns true if path matches against any glob pattern. # Look for more detail about glob pattern in method File::fnmatch. @@ -74,13 +66,7 @@ end # 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 + def self.read_with_options(path, opts = {}) + self.read(path, opts) end end From b4b6df5b6c01d4655b8eed1698670f30c36b7598 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Dec 2013 00:48:10 -0500 Subject: [PATCH 6/8] Remove checks for Ruby 1.8.x --- test/helper.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/test/helper.rb b/test/helper.rb index 5eb41938..97faab12 100644 --- a/test/helper.rb +++ b/test/helper.rb @@ -1,11 +1,9 @@ -if RUBY_VERSION > '1.9' - require 'simplecov' - require 'simplecov-gem-adapter' - SimpleCov.start('gem') +require 'simplecov' +require 'simplecov-gem-adapter' +SimpleCov.start('gem') - require 'coveralls' - Coveralls.wear_merged! -end +require 'coveralls' +Coveralls.wear_merged! require 'rubygems' require 'test/unit' @@ -19,7 +17,6 @@ require 'rdiscount' require 'kramdown' require 'redcarpet' -require 'redgreen' if RUBY_VERSION < '1.9' require 'shoulda' require 'rr' From f14c9db282816a7cde7f764e625b2e078da6cac9 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Dec 2013 00:48:25 -0500 Subject: [PATCH 7/8] Add tests in all the time that was omitted for Ruby 1.8.x --- test/test_convertible.rb | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/test_convertible.rb b/test/test_convertible.rb index 694c152c..c7ad9b9a 100644 --- a/test/test_convertible.rb +++ b/test/test_convertible.rb @@ -36,16 +36,14 @@ class TestConvertible < Test::Unit::TestCase assert_no_match /undefined class\/module DoesNotExist/, out end - if RUBY_VERSION >= '1.9.2' - should "not parse if there is encoding error in file" do - name = 'broken_front_matter3.erb' - out = capture_stdout do - ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8') - assert_equal({}, ret) - end - assert_match(/invalid byte sequence in UTF-8/, out) - assert_match(/#{File.join(@base, name)}/, out) + should "not parse if there is encoding error in file" do + name = 'broken_front_matter3.erb' + out = capture_stdout do + ret = @convertible.read_yaml(@base, name, :encoding => 'utf-8') + assert_equal({}, ret) end + assert_match(/invalid byte sequence in UTF-8/, out) + assert_match(/#{File.join(@base, name)}/, out) end end end From 601f89d4d199c0200041a73375a419c64d09a39e Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sun, 8 Dec 2013 00:50:12 -0500 Subject: [PATCH 8/8] Remove File.read_with_options patch to allow 1.9 and 1.8 to behave the same --- lib/jekyll/convertible.rb | 4 ++-- lib/jekyll/core_ext.rb | 9 --------- lib/jekyll/tags/include.rb | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/lib/jekyll/convertible.rb b/lib/jekyll/convertible.rb index 723b0da7..815c36b0 100644 --- a/lib/jekyll/convertible.rb +++ b/lib/jekyll/convertible.rb @@ -35,8 +35,8 @@ module Jekyll # Returns nothing. def read_yaml(base, name, opts = {}) begin - self.content = File.read_with_options(File.join(base, name), - merged_file_read_opts(opts)) + self.content = File.read(File.join(base, name), + merged_file_read_opts(opts)) if self.content =~ /\A(---\s*\n.*?\n?)^(---\s*$\n?)/m self.content = $POSTMATCH self.data = YAML.safe_load($1) diff --git a/lib/jekyll/core_ext.rb b/lib/jekyll/core_ext.rb index c71c72f5..ce74d2ba 100644 --- a/lib/jekyll/core_ext.rb +++ b/lib/jekyll/core_ext.rb @@ -61,12 +61,3 @@ module Enumerable any? { |exp| File.fnmatch?(exp, e) } 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 - def self.read_with_options(path, opts = {}) - self.read(path, opts) - end -end diff --git a/lib/jekyll/tags/include.rb b/lib/jekyll/tags/include.rb index a261e6f5..49033ab0 100644 --- a/lib/jekyll/tags/include.rb +++ b/lib/jekyll/tags/include.rb @@ -128,7 +128,7 @@ eos # This method allows to modify the file content by inheriting from the class. def source(file, context) - File.read_with_options(file, file_read_opts(context)) + File.read(file, file_read_opts(context)) end end end