hooks for after config

This commit is contained in:
Thomas Reynolds 2011-11-08 15:45:22 -08:00
parent 553be5762c
commit 8a81a7be1c
3 changed files with 4 additions and 13 deletions

View file

@ -34,6 +34,7 @@ module Middleman::CoreExtensions::Features
class << self class << self
def registered(app) def registered(app)
app.set :default_features, [] app.set :default_features, []
app.define_hook :after_configuration
app.extend ClassMethods app.extend ClassMethods
end end
alias :included :registered alias :included :registered
@ -63,16 +64,6 @@ module Middleman::CoreExtensions::Features
register feature register feature
end end
# Add a block/proc to be run after features have been setup
def after_configuration(&block)
@run_after_features ||= []
@run_after_features << block
end
def run_after_features
@run_after_features || []
end
# Load features before starting server # Load features before starting server
def new def new
# Check for and evaluate local configuration # Check for and evaluate local configuration
@ -88,7 +79,7 @@ module Middleman::CoreExtensions::Features
activate ext activate ext
end end
run_after_features.each { |block| class_eval(&block) } run_hook :after_configuration
if logging? if logging?
extensions.each do |ext| extensions.each do |ext|

View file

@ -37,7 +37,7 @@ Gem::Specification.new do |s|
s.add_dependency("sprockets-sass", ["~> 0.3.0"]) s.add_dependency("sprockets-sass", ["~> 0.3.0"])
s.add_dependency("padrino-core", ["~> 0.10.5"]) s.add_dependency("padrino-core", ["~> 0.10.5"])
s.add_dependency("padrino-helpers", ["~> 0.10.5"]) s.add_dependency("padrino-helpers", ["~> 0.10.5"])
s.add_dependency("hooks") s.add_dependency("hooks", ["~> 0.2.0"])
s.add_dependency("eventmachine", ["1.0.0.beta.4.1"]) s.add_dependency("eventmachine", ["1.0.0.beta.4.1"])
s.add_dependency("win32-process", ["~> 0.6.5"]) s.add_dependency("win32-process", ["~> 0.6.5"])

View file

@ -38,7 +38,7 @@ Gem::Specification.new do |s|
s.add_dependency("sprockets-sass", ["~> 0.3.0"]) s.add_dependency("sprockets-sass", ["~> 0.3.0"])
s.add_dependency("padrino-core", ["~> 0.10.5"]) s.add_dependency("padrino-core", ["~> 0.10.5"])
s.add_dependency("padrino-helpers", ["~> 0.10.5"]) s.add_dependency("padrino-helpers", ["~> 0.10.5"])
s.add_dependency("hooks") s.add_dependency("hooks", ["~> 0.2.0"])
s.add_dependency("guard", ["~> 0.8.8"]) s.add_dependency("guard", ["~> 0.8.8"])
s.add_dependency("eventmachine", ["1.0.0.beta.4"]) s.add_dependency("eventmachine", ["1.0.0.beta.4"])