Class: Merb::BootLoader::RackUpApplication
- Inherits:
-
Merb::BootLoader
- Object
- Merb::BootLoader
- Merb::BootLoader::RackUpApplication
- Defined in:
- lib/merb-core/bootloader.rb
Class Method Summary collapse
-
.run ⇒ Object
Setup the Merb Rack App or read a rackup file located at Merb::Config with the same syntax as the rackup tool that comes with rack.
Methods inherited from Merb::BootLoader
after, after_app_loads, before, before_app_loads, before_master_shutdown, before_worker_shutdown, default_framework, finished?, inherited, move_klass
Class Method Details
.run ⇒ Object
Setup the Merb Rack App or read a rackup file located at Merb::Config with the same syntax as the rackup tool that comes with rack. Automatically evals the file in the context of a Rack::Builder.new { } block. Allows for mounting additional apps or middleware.
Returns
nil
1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 |
# File 'lib/merb-core/bootloader.rb', line 1251 def self.run require 'rack' if File.exists?(Merb.dir_for(:config) / "rack.rb") Merb::Config[:rackup] ||= Merb.dir_for(:config) / "rack.rb" end if Merb::Config[:rackup] rackup_code = File.read(Merb::Config[:rackup]) Merb::Config[:app] = eval("::Rack::Builder.new {( #{rackup_code}\n )}.to_app", TOPLEVEL_BINDING, Merb::Config[:rackup]) else Merb::Config[:app] = ::Rack::Builder.new { if prefix = ::Merb::Config[:path_prefix] use Merb::Rack::PathPrefix, prefix end use Merb::Rack::Static, Merb.dir_for(:public) run Merb::Rack::Application.new }.to_app end nil end |