memoize helper methods in site-cleaner (#6808)

Merge pull request 6808
This commit is contained in:
ashmaroli 2018-02-28 21:30:54 +05:30 committed by jekyllbot
parent d2a21fe776
commit 6047927eed
2 changed files with 5 additions and 4 deletions

View File

@ -57,9 +57,9 @@ module Jekyll
#
# Returns a Set with the file paths
def new_files
files = Set.new
site.each_site_file { |item| files << item.destination(site.dest) }
files
@new_files ||= Set.new.tap do |files|
site.each_site_file { |item| files << item.destination(site.dest) }
end
end
# Private: The list of directories to be created when site is built.
@ -67,7 +67,7 @@ module Jekyll
#
# Returns a Set with the directory paths
def new_dirs
new_files.map { |file| parent_dirs(file) }.flatten.to_set
@new_dirs ||= new_files.map { |file| parent_dirs(file) }.flatten.to_set
end
# Private: The list of parent directories of a given file

View File

@ -97,6 +97,7 @@ module Jekyll
@docs_to_write = nil
@regenerator.clear_cache
@liquid_renderer.reset
@site_cleaner = nil
if limit_posts < 0
raise ArgumentError, "limit_posts must be a non-negative number"