don't mess with dir parameter
This commit is contained in:
parent
642349f797
commit
78831d94cd
|
@ -13,6 +13,11 @@ module Jekyll
|
|||
name =~ MATCHER
|
||||
end
|
||||
|
||||
# Get the full path to the directory containing the draft files
|
||||
def get_base(source, dir)
|
||||
return File.join(source, dir, '_drafts')
|
||||
end
|
||||
|
||||
# Extract information from the post filename.
|
||||
#
|
||||
# name - The String filename of the post file.
|
||||
|
|
|
@ -34,7 +34,7 @@ module Jekyll
|
|||
# Returns the new Post.
|
||||
def initialize(site, source, dir, name)
|
||||
@site = site
|
||||
@base = File.join(source, dir)
|
||||
@base = self.get_base(source, dir)
|
||||
@name = name
|
||||
|
||||
self.categories = dir.split('/').reject { |x| x.empty? }
|
||||
|
@ -65,6 +65,11 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
# Get the full path to the directory containing the post files
|
||||
def get_base(source, dir)
|
||||
return File.join(source, dir, '_posts')
|
||||
end
|
||||
|
||||
# Read the YAML frontmatter.
|
||||
#
|
||||
# base - The String path to the dir containing the file.
|
||||
|
|
|
@ -177,9 +177,7 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def read_posts(dir)
|
||||
dir = File.join(dir, '_posts')
|
||||
|
||||
base = File.join(self.source, dir)
|
||||
base = File.join(self.source, dir, '_posts')
|
||||
return unless File.exists?(base)
|
||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
||||
|
||||
|
@ -204,9 +202,7 @@ module Jekyll
|
|||
#
|
||||
# Returns nothing.
|
||||
def read_drafts(dir)
|
||||
dir = File.join(dir, '_drafts')
|
||||
|
||||
base = File.join(self.source, dir)
|
||||
base = File.join(self.source, dir, '_drafts')
|
||||
return unless File.exists?(base)
|
||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
|
||||
|
||||
|
|
|
@ -124,7 +124,7 @@ class TestSite < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
should "read posts" do
|
||||
@site.read_posts('', '_posts')
|
||||
@site.read_posts('')
|
||||
posts = Dir[source_dir('_posts', '*')]
|
||||
assert_equal posts.size - 1, @site.posts.size
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ class TestTags < Test::Unit::TestCase
|
|||
site = Site.new(Jekyll.configuration)
|
||||
|
||||
if override['read_posts']
|
||||
site.read_posts('', '_posts')
|
||||
site.read_posts('')
|
||||
end
|
||||
|
||||
info = { :filters => [Jekyll::Filters], :registers => { :site => site } }
|
||||
|
|
Loading…
Reference in New Issue