module Middleman::CoreExtensions::Extensions::InstanceMethods

def initialize

Load features before starting server
def initialize
  super
  self.class.inst = self
  # Search the root of the project for required files
  $LOAD_PATH.unshift(root)
  ::Middleman::Extension.clear_after_extension_callbacks
  run_hook :initialized
  if config[:autoload_sprockets]
    begin
      require 'middleman-sprockets'
      activate(:sprockets)
    rescue LoadError
    end
  end
  run_hook :before_configuration
  # Check for and evaluate local configuration
  local_config = File.join(root, 'config.rb')
  if File.exists? local_config
    logger.debug '== Reading:  Local config'
    instance_eval File.read(local_config), local_config, 1
  end
  run_hook :build_config if build?
  run_hook :development_config if development?
  run_hook :instance_available
  # This is for making the tests work - since the tests
  # don't completely reload middleman, I18n.load_path can get
  # polluted with paths from other test app directories that don't
  # exist anymore.
  if ENV['TEST']
    ::I18n.load_path.delete_if {|path| path =~ %r{tmp/aruba}}
    ::I18n.reload!
  end
  run_hook :after_configuration
  logger.debug 'Loaded extensions:'
  self.extensions.each do |ext, klass|
    if ext.is_a?(Hash)
      ext.each do |k,_|
        logger.debug "== Extension: #{k}"
      end
    else
      logger.debug "== Extension: #{ext}"
    end
    if klass.is_a?(::Middleman::Extension)
      ::Middleman::Extension.activated_extension(klass)
    end
  end
end