From 35037957a60b8048d32253e56eb86064432256d8 Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Mon, 23 Apr 2012 23:57:42 -0700 Subject: [PATCH] Get rid of some extraneous sitemap refreshes --- .../lib/middleman-core/sitemap/extensions/ignores.rb | 11 ----------- .../lib/middleman-core/sitemap/extensions/proxies.rb | 6 ++++-- middleman-core/lib/middleman-core/sitemap/store.rb | 7 +------ 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb b/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb index 8001f731..602db133 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/ignores.rb @@ -61,10 +61,6 @@ module Middleman::Sitemap::Extensions elsif block_given? @ignored_callbacks << block end - - if @ignored_callbacks.size > original_callback_size - @app.sitemap.rebuild_resource_list!(:added_ignore_rule) - end end # Whether a path is ignored @@ -74,13 +70,6 @@ module Middleman::Sitemap::Extensions path_clean = ::Middleman::Util.normalize_path(path) @ignored_callbacks.any? { |b| b.call(path_clean) } end - - # Update the main sitemap resource list - # @return [void] - def manipulate_resource_list(resources) - # No op - resources - end end end end diff --git a/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb b/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb index e1545ca2..b421bcea 100644 --- a/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb +++ b/middleman-core/lib/middleman-core/sitemap/extensions/proxies.rb @@ -48,7 +48,9 @@ module Middleman::Sitemap::Extensions def get_source_file if proxy? - store.find_resource_by_path(proxied_to).source_file + proxy_resource = store.find_resource_by_path(proxied_to) + raise "Path #{path} proxies to unknown file #{proxied_to}" unless proxy_resource + proxy_resource.source_file end end end @@ -94,4 +96,4 @@ module Middleman::Sitemap::Extensions end end -end \ No newline at end of file +end diff --git a/middleman-core/lib/middleman-core/sitemap/store.rb b/middleman-core/lib/middleman-core/sitemap/store.rb index 96faf607..f24bfc23 100644 --- a/middleman-core/lib/middleman-core/sitemap/store.rb +++ b/middleman-core/lib/middleman-core/sitemap/store.rb @@ -20,7 +20,7 @@ module Middleman::Sitemap def initialize(app) @app = app @resources = [] - + @_lookup_cache = { :path => {}, :destination_path => {} } @resource_list_manipulators = [] @@ -29,11 +29,6 @@ module Middleman::Sitemap # Proxies register_resource_list_manipulator(:proxies, @app.proxy_manager, false) - - # Ignores - register_resource_list_manipulator(:ignores, @app.ignore_manager, false) - - rebuild_resource_list!(:after_base_init) end # Register a klass which can manipulate the main site map list