From e4c3a8d0dfff56d6a0e2501351ee4d7a38fee9d9 Mon Sep 17 00:00:00 2001 From: jbranchaud Date: Fri, 14 Feb 2014 16:02:26 -0300 Subject: [PATCH 1/2] Adding two new test cases for exclude configuration use cases. --- test/test_entry_filter.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/test_entry_filter.rb b/test/test_entry_filter.rb index aea09601..e562277e 100644 --- a/test/test_entry_filter.rb +++ b/test/test_entry_filter.rb @@ -25,6 +25,22 @@ class TestEntryFilter < Test::Unit::TestCase assert_equal files, @site.filter_entries(excludes + files + ["excludeA"]) end + should "filter entries with exclude relative to site source" do + excludes = %w[README TODO css] + files = %w[index.html vendor/css .htaccess] + + @site.exclude = excludes + assert_equal files, @site.filter_entries(excludes + files + ["css"]) + end + + should "filter excluded directory and contained files" do + excludes = %w[README TODO css] + files = %w[index.html .htaccess] + + @site.exclude = excludes + assert_equal files, @site.filter_entries(excludes + files + ["css", "css/main.css", "css/vendor.css"]) + end + should "not filter entries within include" do includes = %w[_index.html .htaccess include*] files = %w[index.html _index.html .htaccess includeA] From 413de3a0ee60943021ce623c4f193b68cb17efcc Mon Sep 17 00:00:00 2001 From: Parker Moore Date: Tue, 6 May 2014 12:46:41 -0400 Subject: [PATCH 2/2] Also exclude an entry if it starts with one of the items given in the exclude key. --- lib/jekyll/entry_filter.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lib/jekyll/entry_filter.rb b/lib/jekyll/entry_filter.rb index 0b00218b..d2cd6f81 100644 --- a/lib/jekyll/entry_filter.rb +++ b/lib/jekyll/entry_filter.rb @@ -65,9 +65,7 @@ module Jekyll entry = ensure_leading_slash(e) enum.any? do |exp| item = ensure_leading_slash(exp) - Jekyll.logger.debug "glob_include?(#{entry})" - Jekyll.logger.debug " ==> File.fnmatch?(#{item}, #{entry}) == #{File.fnmatch?(item, entry)}" - File.fnmatch?(item, entry) + File.fnmatch?(item, entry) || entry.start_with?(item) end end end