Extracted `get_entries` from site.rb into reader.rb
- Extracted - Updated References - Ran Tests Signed-off-by: Martin Jorn Rogalla <martin@martinrogalla.com>
This commit is contained in:
parent
05bbcddb29
commit
6e06fd8734
|
@ -44,5 +44,18 @@ module Jekyll
|
|||
def filter_entries(entries, base_directory = nil)
|
||||
EntryFilter.new(site, base_directory).filter(entries)
|
||||
end
|
||||
|
||||
# Read the entries from a particular directory for processing
|
||||
#
|
||||
# dir - The String relative path of the directory to read
|
||||
# subfolder - The String directory to read
|
||||
#
|
||||
# Returns the list of entries to process
|
||||
def get_entries(dir, subfolder)
|
||||
base = in_source_dir(dir, subfolder)
|
||||
return [] unless File.exist?(base)
|
||||
entries = Dir.chdir(base) { filter_entries(Dir['**/*'], base) }
|
||||
entries.delete_if { |e| File.directory?(in_source_dir(base, e)) }
|
||||
end
|
||||
end
|
||||
end
|
|
@ -199,7 +199,7 @@ module Jekyll
|
|||
end
|
||||
|
||||
def read_content(dir, magic_dir, klass)
|
||||
get_entries(dir, magic_dir).map do |entry|
|
||||
reader.get_entries(dir, magic_dir).map do |entry|
|
||||
klass.new(self, source, dir, entry) if klass.valid?(entry)
|
||||
end.reject do |entry|
|
||||
entry.nil?
|
||||
|
@ -413,19 +413,6 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
# Read the entries from a particular directory for processing
|
||||
#
|
||||
# dir - The String relative path of the directory to read
|
||||
# subfolder - The String directory to read
|
||||
#
|
||||
# Returns the list of entries to process
|
||||
def get_entries(dir, subfolder)
|
||||
base = reader.in_source_dir(dir, subfolder)
|
||||
return [] unless File.exist?(base)
|
||||
entries = Dir.chdir(base) { reader.filter_entries(Dir['**/*'], base) }
|
||||
entries.delete_if { |e| File.directory?(reader.in_source_dir(base, e)) }
|
||||
end
|
||||
|
||||
# Aggregate post information
|
||||
#
|
||||
# post - The Post object to aggregate information for
|
||||
|
|
Loading…
Reference in New Issue