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: diff --git a/Rakefile b/Rakefile index 250c54e6..070dd24b 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 diff --git a/features/support/env.rb b/features/support/env.rb index cf2055a1..07ae1f76 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' @@ -56,15 +54,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}", @@ -79,6 +70,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' diff --git a/jekyll.gemspec b/jekyll.gemspec index 0fe32b6b..091d01ed 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.4.0' 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 54f7c9d5..ce74d2ba 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. @@ -69,18 +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 - 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 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 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' 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