From abeee38126ff908589626e4805b6d6995e2f2acc Mon Sep 17 00:00:00 2001 From: Ben Hollis Date: Sat, 29 Mar 2014 17:17:00 -0700 Subject: [PATCH] Remove yet another way to register extensions and register/activate FrontMatter like a normal extension. --- middleman-core/lib/middleman-core/application.rb | 8 ++++---- .../lib/middleman-core/core_extensions.rb | 5 ++++- .../middleman-core/core_extensions/extensions.rb | 13 ------------- middleman-core/lib/middleman-core/sitemap.rb | 1 - 4 files changed, 8 insertions(+), 19 deletions(-) diff --git a/middleman-core/lib/middleman-core/application.rb b/middleman-core/lib/middleman-core/application.rb index 9a19ba93..8c2c9352 100644 --- a/middleman-core/lib/middleman-core/application.rb +++ b/middleman-core/lib/middleman-core/application.rb @@ -142,10 +142,6 @@ module Middleman # Setup custom rendering include Middleman::CoreExtensions::Rendering - # Parse YAML from templates. Must be before sitemap so sitemap - # extensions see updated frontmatter! - register Middleman::CoreExtensions::FrontMatter - # Sitemap Config options and public api include Middleman::Sitemap @@ -182,6 +178,10 @@ module Middleman # Setup the default values from calls to set before initialization self.class.config.load_settings(self.class.superclass.config.all_settings) + # Parse YAML from templates. Must be before sitemap so sitemap + # extensions see updated frontmatter! + activate :front_matter + # Initialize the Sitemap @sitemap = ::Middleman::Sitemap::Store.new(self) diff --git a/middleman-core/lib/middleman-core/core_extensions.rb b/middleman-core/lib/middleman-core/core_extensions.rb index d61e90a7..340ca2fd 100644 --- a/middleman-core/lib/middleman-core/core_extensions.rb +++ b/middleman-core/lib/middleman-core/core_extensions.rb @@ -12,7 +12,10 @@ require 'middleman-core/core_extensions/extensions' require 'middleman-core/core_extensions/data' # Parse YAML from templates -require 'middleman-core/core_extensions/front_matter' +Middleman::Extensions.register :front_matter do + require 'middleman-core/core_extensions/front_matter' + Middleman::CoreExtensions::FrontMatter +end # External helpers looks in the helpers/ folder for helper modules require 'middleman-core/core_extensions/external_helpers' diff --git a/middleman-core/lib/middleman-core/core_extensions/extensions.rb b/middleman-core/lib/middleman-core/core_extensions/extensions.rb index da366272..cdb0ed87 100644 --- a/middleman-core/lib/middleman-core/core_extensions/extensions.rb +++ b/middleman-core/lib/middleman-core/core_extensions/extensions.rb @@ -62,19 +62,6 @@ module Middleman def configure(env, &block) send("#{env}_config", &block) end - - # Register a new extension - # - # @param [Module] extension Extension modules to register - # @param [Hash] options Per-extension options hash - # @return [void] - def register(extension, options={}, &block) - if extension.ancestors.include?(::Middleman::Extension) - extension.new(self, options, &block) - else - $stderr.puts "!! Tried to register old-style extension: #{extension}" - end - end end # Instance methods diff --git a/middleman-core/lib/middleman-core/sitemap.rb b/middleman-core/lib/middleman-core/sitemap.rb index fbda5b2d..658dc7c5 100644 --- a/middleman-core/lib/middleman-core/sitemap.rb +++ b/middleman-core/lib/middleman-core/sitemap.rb @@ -1,6 +1,5 @@ # Core Sitemap Extensions module Middleman - module Sitemap # Setup Extension