From 7bcf8d689ef28b2d07e7196371ec1854f50c8f2a Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Mon, 29 Dec 2014 19:15:19 -0500 Subject: [PATCH] Always call Time#localtime to translate to TZ'd time. --- features/site_configuration.feature | 2 +- features/step_definitions/jekyll_steps.rb | 10 +++++++++- features/support/env.rb | 11 +++++++++++ lib/jekyll/filters.rb | 2 +- lib/jekyll/utils.rb | 2 +- script/cucumber | 3 --- 6 files changed, 23 insertions(+), 7 deletions(-) diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 13dd7aa1..1d067f0c 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -180,7 +180,7 @@ Feature: Site configuration And I have an "index.html" page with layout "page" that contains "site index page" And I have a configuration file with: | key | value | - | timezone | Australia/Sydney | + | timezone | Australia/Melbourne | And I have a _posts directory And I have the following posts: | title | date | layout | content | diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 3b77d03b..98f14ad1 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -193,7 +193,15 @@ Then /^I should see escaped "(.*)" in "(.*)"$/ do |text, file| end Then /^the "(.*)" file should +exist$/ do |file| - assert File.file?(file), "The file \"#{file}\" does not exist" + file_does_exist = File.file?(file) + unless file_does_exist + all_steps_to_path(file).each do |dir| + STDERR.puts "" + STDERR.puts "Dir #{dir}:" + STDERR.puts Dir["#{dir}/**/*"] + end + end + assert file_does_exist, "The file \"#{file}\" does not exist.\n" end Then /^the "(.*)" file should not exist$/ do |file| diff --git a/features/support/env.rb b/features/support/env.rb index ba4555fe..e995ba9b 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -13,6 +13,17 @@ def source_dir(*files) File.join(TEST_DIR, *files) end +def all_steps_to_path(path) + source = Pathname.new(source_dir('_site')).expand_path + dest = Pathname.new(path).expand_path + paths = [] + dest.ascend do |f| + break if f.eql? source + paths.unshift f.to_s + end + paths +end + def jekyll_output_file JEKYLL_COMMAND_OUTPUT_FILE end diff --git a/lib/jekyll/filters.rb b/lib/jekyll/filters.rb index 17a4142b..fca03437 100644 --- a/lib/jekyll/filters.rb +++ b/lib/jekyll/filters.rb @@ -309,7 +309,7 @@ module Jekyll else Jekyll.logger.error "Invalid Date:", "'#{input}' is not a valid datetime." exit(1) - end + end.localtime end def groupable?(element) diff --git a/lib/jekyll/utils.rb b/lib/jekyll/utils.rb index 34861593..0291c2e9 100644 --- a/lib/jekyll/utils.rb +++ b/lib/jekyll/utils.rb @@ -90,7 +90,7 @@ module Jekyll # Returns the parsed date if successful, throws a FatalException # if not def parse_date(input, msg = "Input could not be parsed.") - Time.parse(input) + Time.parse(input).localtime rescue ArgumentError raise Errors::FatalException.new("Invalid date '#{input}': " + msg) end diff --git a/script/cucumber b/script/cucumber index aeb9032d..c6957356 100755 --- a/script/cucumber +++ b/script/cucumber @@ -1,8 +1,5 @@ #!/bin/bash -ls /usr/share/zoneinfo -ls /usr/share/zoneinfo/Australia - time bundle exec cucumber \ -f Features::Support::Overview \ "$@"