1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00

Use Rack::Builder if available. Fixes #735

This commit is contained in:
Evan Phoenix 2015-09-09 09:10:33 -07:00
parent c26490da4b
commit cddcbe15ee

View file

@ -123,10 +123,24 @@ module Puma
File.basename(Dir.getwd)
end
# Load and use the normal Rack builder if we can, otherwise
# fallback to our minimal version.
def rack_builder
begin
require 'rack'
require 'rack/builder'
rescue LoadError
# ok, use builtin version
return Puma::Rack::Builder
else
return ::Rack::Builder
end
end
def load_rackup
raise "Missing rackup file '#{rackup}'" unless File.exist?(rackup)
rack_app, rack_options = Puma::Rack::Builder.parse_file(rackup)
rack_app, rack_options = rack_builder.parse_file(rackup)
@options.merge!(rack_options)
config_ru_binds = []