From 3a330dc7fcbbd0b4e4fe50a904f1b6b9df6fdb42 Mon Sep 17 00:00:00 2001 From: "maul.esel" Date: Mon, 7 Apr 2014 15:38:11 +0200 Subject: [PATCH] Use Publisher instead of Post#published? --- lib/jekyll/site.rb | 8 +++++--- test/test_post.rb | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/jekyll/site.rb b/lib/jekyll/site.rb index 60093e8f..d9152b9d 100644 --- a/lib/jekyll/site.rb +++ b/lib/jekyll/site.rb @@ -134,9 +134,7 @@ module Jekyll posts = read_content(dir, '_posts', Post) posts.each do |post| - if post.published? && (future || post.date <= time) - aggregate_post_info(post) - end + aggregate_post_info(post) if publisher.publish?(post) end end @@ -391,5 +389,9 @@ module Jekyll name.gsub!(/(^|\b\s)\s+($|\s?\b)/, '\\1\\2') name.gsub(/\s+/, '_') end + + def publisher + @publisher ||= Publisher.new(self) + end end end diff --git a/test/test_post.rb b/test/test_post.rb index d7a57510..87644e24 100644 --- a/test/test_post.rb +++ b/test/test_post.rb @@ -417,12 +417,12 @@ class TestPost < Test::Unit::TestCase context "initializing posts" do should "publish when published yaml is no specified" do post = setup_post("2008-02-02-published.textile") - assert_equal true, post.published? + assert_equal true, @site.send(:publisher).publish?(post) end should "not published when published yaml is false" do post = setup_post("2008-02-02-not-published.textile") - assert_equal false, post.published? + assert_equal false, @site.send(:publisher).publish?(post) end should "recognize date in yaml" do