From fffa80a98748d530520fc492e5809cee28ecbaa0 Mon Sep 17 00:00:00 2001 From: Thomas Reynolds Date: Thu, 24 May 2012 11:01:46 -0700 Subject: [PATCH] Backwards compatibility with old Rack aPI. Fixes #447 --- .../lib/middleman-core/core_extensions/request.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/middleman-core/lib/middleman-core/core_extensions/request.rb b/middleman-core/lib/middleman-core/core_extensions/request.rb index f16a408d..fd76fdc9 100644 --- a/middleman-core/lib/middleman-core/core_extensions/request.rb +++ b/middleman-core/lib/middleman-core/core_extensions/request.rb @@ -22,6 +22,8 @@ module Middleman app.extend ClassMethods app.extend ServerMethods + + Middleman.extend CompatibleClassMethods # Include instance methods app.send :include, InstanceMethods @@ -134,6 +136,18 @@ module Middleman const_set("MiddlemanApplication#{@@servercounter}", Class.new(Middleman::Application)) end end + + module CompatibleClassMethods + # Create a new Class which is based on Middleman::Application + # Used to create a safe sandbox into which extensions and + # configuration can be included later without impacting + # other classes and instances. + # + # @return [Class] + def server(&block) + ::Middleman::Application.server(&block) + end + end # Methods to be mixed-in to Middleman::Application module InstanceMethods