module Middleman::CoreExtensions::Extensions::InstanceMethods

def activate(ext, options={}, &block)

Returns:
  • (void) -

Parameters:
  • ext (Symbol, Module) -- Which extension to activate
def activate(ext, options={}, &block)
  # Make :i18n a no-op
  return if ext == :i18n
  
  ext_module = if ext.is_a?(Module)
    ext
  else
    ::Middleman::Extensions.load(ext.to_sym)
  end
  
  if ext_module.nil?
    puts "== Unknown Extension: #{ext}"
  else
    puts "== Activating: #{ext}" if logging?
    self.class.register(ext_module, options, &block)
  end
end

def initialize

Load features before starting server
def initialize
  super
  
  self.class.inst = self
  run_hook :before_configuration

  # Search the root of the project for required files
  $LOAD_PATH.unshift(root)
  
  # Check for and evaluate local configuration
  local_config = File.join(root, "config.rb")
  if File.exists? local_config
    puts "== Reading:  Local config" if logging?
    instance_eval File.read(local_config), local_config, 1
  end
  
  run_hook :build_config if build?
  run_hook :development_config if development?
  
  run_hook :after_configuration
  
  # Add in defaults
  default_extensions.each do |ext|
    activate ext
  end
  
  if logging?
    self.class.extensions.each do |ext|
      puts "== Extension: #{ext}"
    end
  end
end