This module builds a Padrino server to run the project based on available handlers.
# File lib/padrino-core/server.rb, line 37 def initialize(options, app) @options, @app = options, app end
Starts the application on the available server with specified options.
# File lib/padrino-core/server.rb, line 23 def self.start(app, opts={}) options = {}.merge(opts) # We use a standard hash instead of Thor::CoreExt::HashWithIndifferentAccess options.symbolize_keys! options[:Host] = options.delete(:host) || '0.0.0.0' options[:Port] = options.delete(:port) || 3000 options[:AccessLog] = [] if options[:daemonize] options[:pid] = options[:pid].blank? ? File.expand_path('tmp/pids/server.pid') : opts[:pid] FileUtils.mkdir_p(File.dirname(options[:pid])) end options[:server] = detect_rack_handler if options[:server].blank? new(options, app).start end
The application the server will run.
# File lib/padrino-core/server.rb, line 51 def app @app end
The options specified to the server.
# File lib/padrino-core/server.rb, line 57 def options @options end
Starts the application on the available server with specified options.
# File lib/padrino-core/server.rb, line 42 def start puts "=> Padrino/#{Padrino.version} has taken the stage #{Padrino.env} at http://#{options[:Host]}:#{options[:Port]}" [:INT, :TERM].each { |sig| trap(sig) { exit } } super ensure puts "<= Padrino has ended his set (crowd applauds)" unless options[:daemonize] end
Generated with the Darkfish Rdoc Generator 2.