mirror of
https://github.com/middleman/middleman.git
synced 2022-11-09 12:20:27 -05:00
fix tests on 1.9
This commit is contained in:
parent
b5561227f8
commit
a03ce61627
3 changed files with 27 additions and 10 deletions
|
@ -38,12 +38,6 @@ module Middleman::Base
|
|||
|
||||
app.set :views, "source"
|
||||
|
||||
# Add Builder Callbacks
|
||||
app.register Middleman::CoreExtensions::FileWatcher
|
||||
|
||||
# Sitemap
|
||||
app.register Middleman::CoreExtensions::Sitemap
|
||||
|
||||
# Add Builder Callbacks
|
||||
app.register Middleman::CoreExtensions::Builder
|
||||
|
||||
|
@ -53,6 +47,12 @@ module Middleman::Base
|
|||
# Activate custom features
|
||||
app.register Middleman::CoreExtensions::Features
|
||||
|
||||
# Add Builder Callbacks
|
||||
app.register Middleman::CoreExtensions::FileWatcher
|
||||
|
||||
# Sitemap
|
||||
app.register Middleman::CoreExtensions::Sitemap
|
||||
|
||||
# Activate Yaml Data package
|
||||
app.register Middleman::CoreExtensions::Data
|
||||
|
||||
|
|
|
@ -63,6 +63,16 @@ module Middleman::CoreExtensions::Features
|
|||
register feature
|
||||
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
|
||||
def after_configuration(&block)
|
||||
@run_after_features ||= []
|
||||
|
@ -75,6 +85,8 @@ module Middleman::CoreExtensions::Features
|
|||
|
||||
# Load features before starting server
|
||||
def new
|
||||
run_before_features.each { |block| class_eval(&block) }
|
||||
|
||||
# Check for and evaluate local configuration
|
||||
local_config = File.join(self.root, "config.rb")
|
||||
if File.exists? local_config
|
||||
|
|
|
@ -4,6 +4,10 @@ module Middleman::CoreExtensions::Sitemap
|
|||
class << self
|
||||
def registered(app)
|
||||
app.set :sitemap, SitemapStore.new(app)
|
||||
|
||||
app.before_configuration do
|
||||
app.sitemap.setup
|
||||
end
|
||||
end
|
||||
alias :included :registered
|
||||
end
|
||||
|
@ -15,15 +19,16 @@ module Middleman::CoreExtensions::Sitemap
|
|||
@ignored_paths = false
|
||||
@generic_paths = false
|
||||
@proxied_paths = false
|
||||
|
||||
end
|
||||
|
||||
def setup
|
||||
@source = File.expand_path(@app.views, @app.root)
|
||||
|
||||
build_static_map
|
||||
|
||||
|
||||
@app.on_file_change do |file|
|
||||
touch_file(file)
|
||||
end
|
||||
|
||||
|
||||
@app.on_file_delete do |file|
|
||||
remove_file(file)
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue