From a87cda4b128187740f6ee70c264cb8c4912e0451 Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Sat, 31 Jan 2015 12:22:32 -0800 Subject: [PATCH] Add configuration fallback for paginate, and fix tests. --- features/markdown.feature | 5 ++++- features/pagination.feature | 7 ++++++- features/rendering.feature | 10 +++++++++- features/step_definitions/jekyll_steps.rb | 6 ++++++ lib/jekyll/configuration.rb | 6 ++++++ 5 files changed, 31 insertions(+), 3 deletions(-) diff --git a/features/markdown.feature b/features/markdown.feature index 895c927a..2342951a 100644 --- a/features/markdown.feature +++ b/features/markdown.feature @@ -17,7 +17,10 @@ Feature: Markdown And I should see "

My Title

" in "_site/index.html" Scenario: Markdown in pagination on index - Given I have a configuration file with "paginate" set to "5" + Given I have a configuration file with: + | key | value | + | paginate | 5 | + | gems | [jekyll-paginate] | And I have an "index.html" page that contains "Index - {% for post in paginator.posts %} {{ post.content }} {% endfor %}" And I have a _posts directory And I have the following post: diff --git a/features/pagination.feature b/features/pagination.feature index 21b96b08..b8b89ed0 100644 --- a/features/pagination.feature +++ b/features/pagination.feature @@ -4,7 +4,10 @@ Feature: Site pagination I want divide the posts in several pages Scenario Outline: Paginate with N posts per page - Given I have a configuration file with "paginate" set to "" + Given I have a configuration file with: + | key | value | + | paginate | | + | gems | [jekyll-paginate] | And I have a _layouts directory And I have an "index.html" page that contains "{{ paginator.posts.size }}" And I have a _posts directory @@ -32,6 +35,7 @@ Feature: Site pagination | paginate | 1 | | paginate_path | /blog/page-:num | | permalink | /blog/:year/:month/:day/:title | + | gems | [jekyll-paginate] | And I have a blog directory And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}" And I have a _posts directory @@ -59,6 +63,7 @@ Feature: Site pagination | paginate | 1 | | paginate_path | /blog/page/:num | | permalink | /blog/:year/:month/:day/:title | + | gems | [jekyll-paginate] | And I have a blog directory And I have an "blog/index.html" page that contains "{{ paginator.posts.size }}" And I have an "index.html" page that contains "Don't pick me!" diff --git a/features/rendering.feature b/features/rendering.feature index e0b9d8f0..55a9d3d2 100644 --- a/features/rendering.feature +++ b/features/rendering.feature @@ -15,6 +15,7 @@ Feature: Rendering Scenario: Don't place asset files in layout Given I have an "index.scss" page with layout "simple" that contains ".foo-bar { color:black; }" And I have an "index.coffee" page with layout "simple" that contains "whatever()" + And I have a configuration file with "gems" set to "[jekyll-coffeescript]" And I have a simple layout that contains "{{ content }}Ahoy, indeed!" When I run jekyll build Then the _site directory should exist @@ -28,8 +29,15 @@ Feature: Rendering Then the _site directory should exist And I should see ".foo-bar {\n color: red; }" in "_site/index.css" - Scenario: Render liquid in CoffeeScript + Scenario: Not render liquid in CoffeeScript without explicitly including jekyll-coffeescript Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" When I run jekyll build Then the _site directory should exist + And the "_site/index.js" file should not exist + + Scenario: Render liquid in CoffeeScript with jekyll-coffeescript enabled + Given I have an "index.coffee" page with animal "cicada" that contains "hey='for {{page.animal}}'" + And I have a configuration file with "gems" set to "[jekyll-coffeescript]" + When I run jekyll build + Then the _site directory should exist And I should see "hey = 'for cicada';" in "_site/index.js" diff --git a/features/step_definitions/jekyll_steps.rb b/features/step_definitions/jekyll_steps.rb index ee4f0d37..176629f6 100644 --- a/features/step_definitions/jekyll_steps.rb +++ b/features/step_definitions/jekyll_steps.rb @@ -168,6 +168,12 @@ When /^I delete the file "(.*)"$/ do |file| File.delete(file) end +################## +# +# Checking stuff +# +################## + Then /^the (.*) directory should +exist$/ do |dir| assert File.directory?(dir), "The directory \"#{dir}\" does not exist" end diff --git a/lib/jekyll/configuration.rb b/lib/jekyll/configuration.rb index 77cc90a7..f7f39cb5 100644 --- a/lib/jekyll/configuration.rb +++ b/lib/jekyll/configuration.rb @@ -261,6 +261,12 @@ module Jekyll "Markdown processor. Maruku support has been deprecated and will " + "be removed in 3.0.0. We recommend you switch to Kramdown." end + + if config.key?('paginate') && config['paginate'] && !(config['gems'] || []).include?('jekyll-paginate') + Jekyll::Deprecator.deprecation_message "You appear to have pagination " + + "turned on, but you haven't included the `jekyll-paginate` gem. " + + "Ensure you have `gems: [jekyll-paginate]` in your configuration file." + end config end