From 5cab7c46a9dc411d46142915866a293f7ba9f431 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 31 Aug 2015 11:18:45 -0700 Subject: [PATCH] Store intermediate resources in reducer so the array is not empty the first run. Addresses #1590 --- middleman-core/lib/middleman-core/sitemap/store.rb | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index a5541349..aa46497b 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -211,20 +211,21 @@ module Middleman @app.logger.debug '== Rebuilding resource list' - @resources = @resource_list_manipulators.reduce([]) do |result, (_, inst)| - newres = inst.manipulate_resource_list(result) + @resources = [] + + @resource_list_manipulators.each do |(_, inst)| + @resources = inst.manipulate_resource_list(@resources) # Reset lookup cache reset_lookup_cache! - newres.each do |resource| + + @resources.each do |resource| @_lookup_by_path[resource.path] = resource @_lookup_by_destination_path[resource.destination_path] = resource end - newres + invalidate_resources_not_ignored_cache! end - - invalidate_resources_not_ignored_cache! end end