Merge pull request #875 from mojombo/posts-cant-be-dirs
Directories with valid post names should be filtered out
This commit is contained in:
commit
0f2c9d29ee
|
@ -405,6 +405,7 @@ module Jekyll
|
||||||
base = File.join(self.source, dir, subfolder)
|
base = File.join(self.source, dir, subfolder)
|
||||||
return [] unless File.exists?(base)
|
return [] unless File.exists?(base)
|
||||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
||||||
|
entries.delete_if { |e| File.directory?(File.join(base, e)) }
|
||||||
end
|
end
|
||||||
|
|
||||||
# Aggregate post information
|
# Aggregate post information
|
||||||
|
|
|
@ -161,6 +161,7 @@ class TestSite < Test::Unit::TestCase
|
||||||
should "read posts" do
|
should "read posts" do
|
||||||
@site.read_posts('')
|
@site.read_posts('')
|
||||||
posts = Dir[source_dir('_posts', '*')]
|
posts = Dir[source_dir('_posts', '*')]
|
||||||
|
posts.delete_if { |post| File.directory?(post) }
|
||||||
assert_equal posts.size - 1, @site.posts.size
|
assert_equal posts.size - 1, @site.posts.size
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -169,9 +170,10 @@ class TestSite < Test::Unit::TestCase
|
||||||
@site.process
|
@site.process
|
||||||
|
|
||||||
posts = Dir[source_dir("**", "_posts", "*")]
|
posts = Dir[source_dir("**", "_posts", "*")]
|
||||||
|
posts.delete_if { |post| File.directory?(post) }
|
||||||
categories = %w(bar baz category foo z_category publish_test win).sort
|
categories = %w(bar baz category foo z_category publish_test win).sort
|
||||||
|
|
||||||
assert_equal posts.size - 1, @site.posts.size
|
assert_equal posts.size, @site.posts.size
|
||||||
assert_equal categories, @site.categories.keys.sort
|
assert_equal categories, @site.categories.keys.sort
|
||||||
assert_equal 4, @site.categories['foo'].size
|
assert_equal 4, @site.categories['foo'].size
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue