2011-08-04 22:43:42 -04:00
|
|
|
module Middleman::CoreExtensions::Builder
|
|
|
|
class << self
|
|
|
|
def registered(app)
|
|
|
|
app.extend ClassMethods
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
module ClassMethods
|
|
|
|
# Add a block/proc to be run after features have been setup
|
|
|
|
def after_build(&block)
|
2011-11-08 18:10:53 -05:00
|
|
|
::Middleman::Builder.after_build(&block)
|
2011-08-04 22:43:42 -04:00
|
|
|
end
|
2011-08-04 22:52:23 -04:00
|
|
|
|
|
|
|
def build_reroute(&block)
|
|
|
|
@build_rerouters ||= []
|
|
|
|
@build_rerouters << block
|
|
|
|
end
|
|
|
|
|
|
|
|
def reroute_builder(desination, request_path)
|
|
|
|
@build_rerouters ||= []
|
|
|
|
|
|
|
|
result = [desination, request_path]
|
|
|
|
|
|
|
|
@build_rerouters.each do |block|
|
|
|
|
output = block.call(desination, request_path)
|
|
|
|
if output
|
|
|
|
result = output
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
result
|
|
|
|
end
|
2011-08-04 22:43:42 -04:00
|
|
|
end
|
|
|
|
end
|