From 72fa7f8a7345b68dc9ca3840aab754d25419e32b Mon Sep 17 00:00:00 2001 From: John Piasetzki Date: Sat, 25 May 2013 11:32:47 -0400 Subject: [PATCH] Switch cucumber features to use iso dates --- features/create_sites.feature | 16 ++++----- features/drafts.feature | 4 +-- features/embed_filters.feature | 10 +++--- features/markdown.feature | 4 +-- features/pagination.feature | 16 ++++----- features/permalinks.feature | 10 +++--- features/post_data.feature | 42 +++++++++++------------ features/site_configuration.feature | 18 +++++----- features/site_data.feature | 28 +++++++-------- features/step_definitions/jekyll_steps.rb | 7 +--- features/support/env.rb | 13 +------ 11 files changed, 76 insertions(+), 92 deletions(-) diff --git a/features/create_sites.feature b/features/create_sites.feature index cbdfb64b..24e669bc 100644 --- a/features/create_sites.feature +++ b/features/create_sites.feature @@ -13,7 +13,7 @@ Feature: Create sites Given I have a _posts directory And I have the following post: | title | date | content | - | Hackers | 3/27/2009 | My First Exploit | + | Hackers | 2009-03-27 | My First Exploit | When I run jekyll Then the _site directory should exist And I should see "My First Exploit" in "_site/2009/03/27/hackers.html" @@ -31,7 +31,7 @@ Feature: Create sites And I have a _posts directory And I have the following posts: | title | date | layout | content | - | Wargames | 3/27/2009 | default | The only winning move is not to play. | + | Wargames | 2009-03-27 | default | The only winning move is not to play. | And I have a default layout that contains "Post Layout: {{ content }}" When I run jekyll Then the _site directory should exist @@ -49,13 +49,13 @@ Feature: Create sites And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 3/27/2009 | post | content for entry1. | - | entry2 | 4/27/2009 | post | content for entry2. | + | entry1 | 2009-03-27 | post | content for entry1. | + | entry2 | 2009-04-27 | post | content for entry2. | And I have a category/_posts directory And I have the following posts in "category": | title | date | layout | content | - | entry3 | 5/27/2009 | post | content for entry3. | - | entry4 | 6/27/2009 | post | content for entry4. | + | entry3 | 2009-05-27 | post | content for entry3. | + | entry4 | 2009-06-27 | post | content for entry4. | When I run jekyll Then the _site directory should exist And I should see "Page : Site contains 2 pages and 4 posts" in "_site/index.html" @@ -99,8 +99,8 @@ Feature: Create sites And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 12/31/2007 | post | content for entry1. | - | entry2 | 01/31/2020 | post | content for entry2. | + | entry1 | 2007-12-31 | post | content for entry1. | + | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll Then the _site directory should exist And I should see "URL: /2020/01/31/entry2/" in "_site/index.html" diff --git a/features/drafts.feature b/features/drafts.feature index 27b3f074..5271120b 100644 --- a/features/drafts.feature +++ b/features/drafts.feature @@ -8,7 +8,7 @@ Feature: Draft Posts And I have a _drafts directory And I have the following draft: | title | date | layout | content | - | Recipe | 3/27/2009 | default | Not baked yet. | + | Recipe | 2009-03-27 | default | Not baked yet. | When I run jekyll with drafts Then the _site directory should exist And I should see "Not baked yet." in "_site/recipe.html" @@ -19,7 +19,7 @@ Feature: Draft Posts And I have a _drafts directory And I have the following draft: | title | date | layout | content | - | Recipe | 3/27/2009 | default | Not baked yet. | + | Recipe | 2009-03-27 | default | Not baked yet. | When I run jekyll Then the _site directory should exist And the "_site/recipe.html" file should not exist diff --git a/features/embed_filters.feature b/features/embed_filters.feature index 61bd8da0..d61901c8 100644 --- a/features/embed_filters.feature +++ b/features/embed_filters.feature @@ -8,7 +8,7 @@ Feature: Embed filters And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. | + | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ site.time | date_to_xmlschema }}" When I run jekyll Then the _site directory should exist @@ -19,7 +19,7 @@ Feature: Embed filters And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star & Wars | 3/27/2009 | default | These aren't the droids you're looking for. | + | Star & Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ page.title | xml_escape }}" When I run jekyll Then the _site directory should exist @@ -30,7 +30,7 @@ Feature: Embed filters And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. | + | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "{{ content | xml_escape }}" When I run jekyll Then the _site directory should exist @@ -41,7 +41,7 @@ Feature: Embed filters And I have a _layouts directory And I have the following post: | title | date | layout | tags | content | - | Star Wars | 3/27/2009 | default | [scifi, movies, force] | These aren't the droids you're looking for. | + | Star Wars | 2009-03-27 | default | [scifi, movies, force] | These aren't the droids you're looking for. | And I have a default layout that contains "{{ page.tags | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist @@ -52,7 +52,7 @@ Feature: Embed filters And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | default | These aren't the droids you're looking for. | + | Star Wars | 2009-03-27 | default | These aren't the droids you're looking for. | And I have a default layout that contains "By {{ '_Obi-wan_' | textilize }}" When I run jekyll Then the _site directory should exist diff --git a/features/markdown.feature b/features/markdown.feature index 859e6f7e..7aedbe44 100644 --- a/features/markdown.feature +++ b/features/markdown.feature @@ -9,7 +9,7 @@ Feature: Markdown And I have a _posts directory And I have the following post: | title | date | content | type | - | Hackers | 3/27/2009 | # My Title | markdown | + | Hackers | 2009-03-27 | # My Title | markdown | When I run jekyll Then the _site directory should exist And I should see "Index" in "_site/index.html" @@ -22,7 +22,7 @@ Feature: Markdown And I have a _posts directory And I have the following post: | title | date | content | type | - | Hackers | 3/27/2009 | # My Title | markdown | + | Hackers | 2009-03-27 | # My Title | markdown | When I run jekyll Then the _site directory should exist And I should see "Index" in "_site/index.html" diff --git a/features/pagination.feature b/features/pagination.feature index 9482f18f..4259caf1 100644 --- a/features/pagination.feature +++ b/features/pagination.feature @@ -10,10 +10,10 @@ Feature: Site pagination And I have a _posts directory And I have the following posts: | title | date | layout | content | - | Wargames | 3/27/2009 | default | The only winning move is not to play. | - | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. | - | Wargames3 | 5/27/2009 | default | The only winning move is not to play3. | - | Wargames4 | 6/27/2009 | default | The only winning move is not to play4. | + | Wargames | 2009-03-27 | default | The only winning move is not to play. | + | Wargames2 | 2009-04-27 | default | The only winning move is not to play2. | + | Wargames3 | 2009-05-27 | default | The only winning move is not to play3. | + | Wargames4 | 2009-06-27 | default | The only winning move is not to play4. | When I run jekyll Then the _site/page directory should exist And the "_site/page/index.html" file should exist @@ -37,10 +37,10 @@ Feature: Site pagination And I have a _posts directory And I have the following posts: | title | date | layout | content | - | Wargames | 3/27/2009 | default | The only winning move is not to play. | - | Wargames2 | 4/27/2009 | default | The only winning move is not to play2. | - | Wargames3 | 5/27/2009 | default | The only winning move is not to play3. | - | Wargames4 | 6/27/2009 | default | The only winning move is not to play4. | + | Wargames | 2009-03-27 | default | The only winning move is not to play. | + | Wargames2 | 2009-04-27 | default | The only winning move is not to play2. | + | Wargames3 | 2009-05-27 | default | The only winning move is not to play3. | + | Wargames4 | 2009-06-27 | default | The only winning move is not to play4. | When I run jekyll Then the _site/blog/page- directory should exist And the "_site/blog/page-/index.html" file should exist diff --git a/features/permalinks.feature b/features/permalinks.feature index 050e75c3..14e0d1e3 100644 --- a/features/permalinks.feature +++ b/features/permalinks.feature @@ -7,7 +7,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | date | content | - | None Permalink Schema | 3/27/2009 | Totally nothing. | + | None Permalink Schema | 2009-03-27 | Totally nothing. | And I have a configuration file with "permalink" set to "none" When I run jekyll Then the _site directory should exist @@ -17,7 +17,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | date | content | - | Pretty Permalink Schema | 3/27/2009 | Totally wordpress. | + | Pretty Permalink Schema | 2009-03-27 | Totally wordpress. | And I have a configuration file with "permalink" set to "pretty" When I run jekyll Then the _site directory should exist @@ -38,7 +38,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | category | date | content | - | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. | + | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/blog/:year/:month/:day/:title" When I run jekyll Then the _site directory should exist @@ -48,7 +48,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | category | date | content | - | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. | + | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/:categories/:title.html" When I run jekyll Then the _site directory should exist @@ -58,7 +58,7 @@ Feature: Fancy permalinks Given I have a _posts directory And I have the following post: | title | category | date | content | - | Custom Permalink Schema | stuff | 3/27/2009 | Totally custom. | + | Custom Permalink Schema | stuff | 2009-03-27 | Totally custom. | And I have a configuration file with "permalink" set to "/:month-:day-:year/:title.html" When I run jekyll Then the _site directory should exist diff --git a/features/post_data.feature b/features/post_data.feature index 3ba37062..34f58187 100644 --- a/features/post_data.feature +++ b/features/post_data.feature @@ -8,7 +8,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post title: {{ page.title }}" When I run jekyll Then the _site directory should exist @@ -19,7 +19,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post url: {{ page.url }}" When I run jekyll Then the _site directory should exist @@ -30,7 +30,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post date: {{ page.date | date_to_string }}" When I run jekyll Then the _site directory should exist @@ -41,7 +41,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post id: {{ page.id }}" When I run jekyll Then the _site directory should exist @@ -52,7 +52,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post content: {{ content }}" When I run jekyll Then the _site directory should exist @@ -64,7 +64,7 @@ Feature: Post data And I have a _layouts directory And I have the following post in "movies": | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll Then the _site directory should exist @@ -75,7 +75,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | tag | content | - | Star Wars | 5/18/2009 | simple | twist | Luke, I am your father. | + | Star Wars | 2009-05-18 | simple | twist | Luke, I am your father. | And I have a simple layout that contains "Post tags: {{ page.tags }}" When I run jekyll Then the _site directory should exist @@ -88,7 +88,7 @@ Feature: Post data And I have a _layouts directory And I have the following post in "scifi/movies": | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist @@ -101,7 +101,7 @@ Feature: Post data And I have a _layouts directory And I have the following post in "scifi/Movies": | title | date | layout | content | - | Star Wars | 3/27/2009 | simple | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Luke, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist @@ -112,7 +112,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | category | content | - | Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll Then the _site directory should exist @@ -123,7 +123,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | category | content | - | Star Wars | 3/27/2009 | simple | Movies | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll Then the _site directory should exist @@ -134,7 +134,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | category | content | - | Star Wars | 3/27/2009 | simple | movies | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | movies | Luke, I am your father. | And I have a simple layout that contains "Post category: {{ page.categories }}" When I run jekyll Then the _site directory should exist @@ -145,8 +145,8 @@ Feature: Post data And I have a _layouts directory And I have the following posts: | title | date | layout | categories | content | - | Star Wars | 3/27/2009 | simple | ['scifi', 'Movies'] | Luke, I am your father. | - | Star Trek | 3/17/2013 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. | + | Star Wars | 2009-03-27 | simple | ['scifi', 'Movies'] | Luke, I am your father. | + | Star Trek | 2013-03-17 | simple | ['SciFi', 'movies'] | Jean Luc, I am your father. | And I have a simple layout that contains "Post categories: {{ page.categories | array_to_sentence_string }}" When I run jekyll Then the _site directory should exist @@ -157,7 +157,7 @@ Feature: Post data Given I have a /_posts directory And I have the following post in "": | title | type | date | content | - | my-post | html | 4/12/2013 | Source path: {{ page.path }} | + | my-post | html | 2013-04-12 | Source path: {{ page.path }} | When I run jekyll Then the _site directory should exist And I should see "Source path: _posts/2013-04-12-my-post.html" in "_site//2013/04/12/my-post.html" @@ -172,7 +172,7 @@ Feature: Post data Given I have a _posts directory And I have the following post: | title | date | path | content | - | override | 4/12/2013 | override-path.html | Custom path: {{ page.path }} | + | override | 2013-04-12 | override-path.html | Custom path: {{ page.path }} | When I run jekyll Then the _site directory should exist And I should see "Custom path: override-path.html" in "_site/2013/04/12/override.html" @@ -182,7 +182,7 @@ Feature: Post data And I have an "index.html" file that contains "Published!" And I have the following post: | title | date | layout | published | content | - | Star Wars | 3/27/2009 | simple | false | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | false | Luke, I am your father. | When I run jekyll Then the _site directory should exist And the "_site/2009/03/27/star-wars.html" file should not exist @@ -193,7 +193,7 @@ Feature: Post data And I have a _layouts directory And I have the following post: | title | date | layout | author | content | - | Star Wars | 3/27/2009 | simple | Darth Vader | Luke, I am your father. | + | Star Wars | 2009-03-27 | simple | Darth Vader | Luke, I am your father. | And I have a simple layout that contains "Post author: {{ page.author }}" When I run jekyll Then the _site directory should exist @@ -204,9 +204,9 @@ Feature: Post data And I have a _layouts directory And I have the following posts: | title | date | layout | author | content | - | Star Wars | 3/27/2009 | ordered | Darth Vader | Luke, I am your father. | - | Some like it hot | 4/27/2009 | ordered | Osgood | Nobody is perfect. | - | Terminator | 5/27/2009 | ordered | Arnold | Sayonara, baby | + | Star Wars | 2009-03-27 | ordered | Darth Vader | Luke, I am your father. | + | Some like it hot | 2009-04-27 | ordered | Osgood | Nobody is perfect. | + | Terminator | 2009-05-27 | ordered | Arnold | Sayonara, baby | And I have a ordered layout that contains "Previous post: {{ page.previous.title }} and next post: {{ page.next.title }}" When I run jekyll Then the _site directory should exist diff --git a/features/site_configuration.feature b/features/site_configuration.feature index 14f29be7..706e5b66 100644 --- a/features/site_configuration.feature +++ b/features/site_configuration.feature @@ -88,8 +88,8 @@ Feature: Site configuration And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 12/31/2007 | post | content for entry1. | - | entry2 | 01/31/2020 | post | content for entry2. | + | entry1 | 2007-12-31 | post | content for entry1. | + | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll Then the _site directory should exist And I should see "Page Layout: 1 on 2010-01-01" in "_site/index.html" @@ -108,8 +108,8 @@ Feature: Site configuration And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 12/31/2007 | post | content for entry1. | - | entry2 | 01/31/2020 | post | content for entry2. | + | entry1 | 2007-12-31 | post | content for entry1. | + | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll Then the _site directory should exist And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" @@ -163,9 +163,9 @@ Feature: Site configuration | limit_posts | 2 | And I have the following posts: | title | date | content | - | Apples | 3/27/2009 | An article about apples | - | Oranges | 4/1/2009 | An article about oranges | - | Bananas | 4/5/2009 | An article about bananas | + | Apples | 2009-03-27 | An article about apples | + | Oranges | 2009-04-01 | An article about oranges | + | Bananas | 2009-04-05 | An article about bananas | When I run jekyll Then the _site directory should exist And the "_site/2009/04/05/bananas.html" file should exist @@ -197,8 +197,8 @@ Feature: Site configuration And I have a _posts directory And I have the following posts: | title | date | layout | content | - | entry1 | 12/31/2007 | post | content for entry1. | - | entry2 | 01/31/2020 | post | content for entry2. | + | entry1 | 2007-12-31 | post | content for entry1. | + | entry2 | 2020-01-31 | post | content for entry2. | When I run jekyll Then the _site directory should exist And I should see "Page Layout: 2 on 2010-01-01" in "_site/index.html" diff --git a/features/site_data.feature b/features/site_data.feature index 47f34ec0..ccb349c6 100644 --- a/features/site_data.feature +++ b/features/site_data.feature @@ -39,9 +39,9 @@ Feature: Site data And I have an "index.html" page that contains "{{ site.posts.first.title }}: {{ site.posts.first.url }}" And I have the following posts: | title | date | content | - | First Post | 3/25/2009 | My First Post | - | Second Post | 3/26/2009 | My Second Post | - | Third Post | 3/27/2009 | My Third Post | + | First Post | 2009-03-25 | My First Post | + | Second Post | 2009-03-26 | My Second Post | + | Third Post | 2009-03-27 | My Third Post | When I run jekyll Then the _site directory should exist And I should see "Third Post: /2009/03/27/third-post.html" in "_site/index.html" @@ -51,9 +51,9 @@ Feature: Site data And I have an "index.html" page that contains "{% for post in site.posts %} {{ post.title }} {% endfor %}" And I have the following posts: | title | date | content | - | First Post | 3/25/2009 | My First Post | - | Second Post | 3/26/2009 | My Second Post | - | Third Post | 3/27/2009 | My Third Post | + | First Post | 2009-03-25 | My First Post | + | Second Post | 2009-03-26 | My Second Post | + | Third Post | 2009-03-27 | My Third Post | When I run jekyll Then the _site directory should exist And I should see "Third Post Second Post First Post" in "_site/index.html" @@ -63,8 +63,8 @@ Feature: Site data And I have an "index.html" page that contains "{% for post in site.categories.code %} {{ post.title }} {% endfor %}" And I have the following posts: | title | date | category | content | - | Awesome Hack | 3/26/2009 | code | puts 'Hello World' | - | Delicious Beer | 3/26/2009 | food | 1) Yuengling | + | Awesome Hack | 2009-03-26 | code | puts 'Hello World' | + | Delicious Beer | 2009-03-26 | food | 1) Yuengling | When I run jekyll Then the _site directory should exist And I should see "Awesome Hack" in "_site/index.html" @@ -74,7 +74,7 @@ Feature: Site data And I have an "index.html" page that contains "{% for post in site.tags.beer %} {{ post.content }} {% endfor %}" And I have the following posts: | title | date | tag | content | - | Delicious Beer | 3/26/2009 | beer | 1) Yuengling | + | Delicious Beer | 2009-03-26 | beer | 1) Yuengling | When I run jekyll Then the _site directory should exist And I should see "Yuengling" in "_site/index.html" @@ -84,11 +84,11 @@ Feature: Site data And I have an "index.html" page that contains "{% for post in site.posts %}{{ post.title }}:{{ post.previous.title}},{{ post.next.title}} {% endfor %}" And I have the following posts: | title | date | content | - | first | 2/26/2009 | first | - | A | 3/26/2009 | A | - | B | 3/26/2009 | B | - | C | 3/26/2009 | C | - | last | 4/26/2009 | last | + | first | 2009-02-26 | first | + | A | 2009-03-26 | A | + | B | 2009-03-26 | B | + | C | 2009-03-26 | C | + | last | 2009-04-26 | last | When I run jekyll Then the _site directory should exist And I should see "last:C, C:B,last B:A,C A:first,B first:,A" in "_site/index.html" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index 696ddcb8..19a8b2c2 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -53,16 +53,11 @@ Given /^I have the following (draft|post)s?(?: (in|under) "([^"]+)")?:$/ do |sta ext = post['type'] || 'textile' before, after = location(folder, direction) - if post['date'] - in_format, out_format = time_format(post['date']) - parsed_date = DateTime.strptime(post['date'], in_format) - post['date'] = parsed_date.strftime(out_format) - end - if "draft" == status folder_post = '_drafts' filename = "#{title}.#{ext}" elsif "post" == status + parsed_date = Time.xmlschema(post['date']) rescue Time.parse(post['date']) folder_post = '_posts' filename = "#{parsed_date.strftime('%Y-%m-%d')}-#{title}.#{ext}" end diff --git a/features/support/env.rb b/features/support/env.rb index f21d61c3..a7588d98 100644 --- a/features/support/env.rb +++ b/features/support/env.rb @@ -1,6 +1,7 @@ require 'fileutils' require 'rr' require 'test/unit' +require 'time' TEST_DIR = File.join('/', 'tmp', 'jekyll') JEKYLL_PATH = File.join(File.dirname(__FILE__), '..', '..', 'bin', 'jekyll') @@ -13,18 +14,6 @@ def run_jekyll(opts = {}) system command end -def time_format(date) - if has_time_component?(date) - ['%Y-%m-%d %H:%M %z'] * 2 - else - ['%m/%d/%Y', '%Y-%m-%d %H:%M'] - end -end - -def has_time_component?(date_string) - date_string.split(" ").size > 1 -end - def slug(title) title.downcase.gsub(/[^\w]/, " ").strip.gsub(/\s+/, '-') end