From ad93f3d8aeb487d72624f29c24765ece5d2be9fb Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Mon, 18 Aug 2014 14:53:15 -0700 Subject: [PATCH] fix some uncaught regressions --- middleman-core/lib/middleman-core/application.rb | 13 ++++++++++++- .../lib/middleman-core/core_extensions/data.rb | 1 + .../middleman-core/meta_pages/sitemap_resource.rb | 2 +- 3 files changed, 14 insertions(+), 2 deletions(-) diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index d1db0fd2..7805bc9e 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -148,7 +148,18 @@ module Middleman # Setup callbacks which can exclude paths from the sitemap config.define_setting :ignored_sitemap_matchers, { # Files starting with an underscore, but not a double-underscore - partials: proc { |file| File.basename(file[:relative_path]).match %r{^_[^_]} }, + partials: proc { |file| + ignored = false + + file[:relative_path].ascend do |f| + if f.basename.to_s.match %r{^_[^_]} + ignored = true + break + end + end + + ignored + }, layout: proc { |file, _sitemap_app| file[:relative_path].to_s.start_with?('layout.') || diff --git a/middleman-core/lib/middleman-core/core_extensions/data.rb b/middleman-core/lib/middleman-core/core_extensions/data.rb index feeed805..87fd77af 100644 --- a/middleman-core/lib/middleman-core/core_extensions/data.rb +++ b/middleman-core/lib/middleman-core/core_extensions/data.rb @@ -17,6 +17,7 @@ module Middleman @data_store = DataStore.new(app, DATA_FILE_MATCHER) app.config.define_setting :data_dir, 'data', 'The directory data files are stored in' + app.add_to_instance(:data, &method(:data_store)) app.add_to_config_context(:data, &method(:data_store)) start_watching(app.config[:data_dir]) diff --git a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb index 40c4970d..cc420ff4 100644 --- a/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb +++ b/middleman-core/lib/middleman-core/meta_pages/sitemap_resource.rb @@ -39,7 +39,7 @@ module Middleman build_path = 'Not built' if ignored? props['Build Path'] = build_path if @resource.path != build_path props['URL'] = content_tag(:a, @resource.url, href: @resource.url) unless ignored? - props['Source File'] = @resource.source_file[:full_path].to_s + props['Source File'] = @resource.source_file ? @resource.source_file[:full_path].to_s : 'Dynamic' data = @resource.data props['Data'] = data.inspect unless data.empty?