fix tests on 1.9

This commit is contained in:
Thomas Reynolds 2011-11-07 23:31:43 -08:00
parent b5561227f8
commit a03ce61627
3 changed files with 27 additions and 10 deletions

View file

@ -38,12 +38,6 @@ module Middleman::Base
app.set :views, "source" app.set :views, "source"
# Add Builder Callbacks
app.register Middleman::CoreExtensions::FileWatcher
# Sitemap
app.register Middleman::CoreExtensions::Sitemap
# Add Builder Callbacks # Add Builder Callbacks
app.register Middleman::CoreExtensions::Builder app.register Middleman::CoreExtensions::Builder
@ -53,6 +47,12 @@ module Middleman::Base
# Activate custom features # Activate custom features
app.register Middleman::CoreExtensions::Features app.register Middleman::CoreExtensions::Features
# Add Builder Callbacks
app.register Middleman::CoreExtensions::FileWatcher
# Sitemap
app.register Middleman::CoreExtensions::Sitemap
# Activate Yaml Data package # Activate Yaml Data package
app.register Middleman::CoreExtensions::Data app.register Middleman::CoreExtensions::Data

View file

@ -63,6 +63,16 @@ module Middleman::CoreExtensions::Features
register feature register feature
end end
# Add a block/proc to be run after features have been setup
def before_configuration(&block)
@run_before_features ||= []
@run_before_features << block
end
def run_before_features
@run_before_features || []
end
# Add a block/proc to be run after features have been setup # Add a block/proc to be run after features have been setup
def after_configuration(&block) def after_configuration(&block)
@run_after_features ||= [] @run_after_features ||= []
@ -75,6 +85,8 @@ module Middleman::CoreExtensions::Features
# Load features before starting server # Load features before starting server
def new def new
run_before_features.each { |block| class_eval(&block) }
# Check for and evaluate local configuration # Check for and evaluate local configuration
local_config = File.join(self.root, "config.rb") local_config = File.join(self.root, "config.rb")
if File.exists? local_config if File.exists? local_config

View file

@ -4,6 +4,10 @@ module Middleman::CoreExtensions::Sitemap
class << self class << self
def registered(app) def registered(app)
app.set :sitemap, SitemapStore.new(app) app.set :sitemap, SitemapStore.new(app)
app.before_configuration do
app.sitemap.setup
end
end end
alias :included :registered alias :included :registered
end end
@ -15,9 +19,10 @@ module Middleman::CoreExtensions::Sitemap
@ignored_paths = false @ignored_paths = false
@generic_paths = false @generic_paths = false
@proxied_paths = false @proxied_paths = false
end
def setup
@source = File.expand_path(@app.views, @app.root) @source = File.expand_path(@app.views, @app.root)
build_static_map build_static_map
@app.on_file_change do |file| @app.on_file_change do |file|