Sha256: b42187db5c47ae08ced8fc8278320bef99c825c6c2ca2b1111df8c0054313b18
Contents?: true
Size: 972 Bytes
Versions: 18
Compression:
Stored size: 972 Bytes
Contents
module Sinatra class Base class << self def run!(options={}) set options handler = detect_rack_handler handler_name = handler.name.gsub(/.*::/, '') # handler specific options use the lower case handler name as hash key, if present handler_opts = begin send(handler_name.downcase) rescue NoMethodError {} end puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " + "on #{port} for #{environment} with backup from #{handler_name}" unless handler_name =~/cgi/i handler.run self, handler_opts.merge(:Host => bind, :Port => port) do |server| [:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } } set :running, true end rescue Errno::EADDRINUSE => e puts "== Someone is already performing on port #{port}!" end end end end
Version data entries
18 entries across 18 versions & 1 rubygems