Class: Padrino::Server
- Inherits:
-
Rack::Server
- Object
- Rack::Server
- Padrino::Server
- Defined in:
- lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb
Overview
This module builds a Padrino server to run the project based on available handlers.
Constant Summary collapse
- Handlers =
Server Handlers
[:thin, :puma, :mongrel, :trinidad, :webrick]
Class Method Summary collapse
-
.start(app, opts = {}) ⇒ Object
Starts the application on the available server with specified options.
Instance Method Summary collapse
-
#app ⇒ Object
(also: #wrapped_app)
The application the server will run.
-
#initialize(options, app) ⇒ Server
constructor
A new instance of Server.
-
#options ⇒ Object
The options specified to the server.
-
#start ⇒ Object
Starts the application on the available server with specified options.
Constructor Details
#initialize(options, app) ⇒ Server
Returns a new instance of Server.
37 38 39 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb', line 37 def initialize(, app) @options, @app = , app end |
Class Method Details
.start(app, opts = {}) ⇒ Object
Starts the application on the available server with specified options.
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb', line 23 def self.start(app, opts={}) = {}.merge(opts) # We use a standard hash instead of Thor::CoreExt::HashWithIndifferentAccess .symbolize_keys! [:Host] = .delete(:host) || '127.0.0.1' [:Port] = .delete(:port) || 3000 [:AccessLog] = [] if [:daemonize] [:pid] = File.([:pid].blank? ? 'tmp/pids/server.pid' : opts[:pid]) FileUtils.mkdir_p(File.dirname([:pid])) end [:server] = detect_rack_handler if [:server].blank? new(, app).start end |
Instance Method Details
#app ⇒ Object Also known as: wrapped_app
The application the server will run.
51 52 53 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb', line 51 def app @app end |
#options ⇒ Object
The options specified to the server.
57 58 59 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb', line 57 def @options end |
#start ⇒ Object
Starts the application on the available server with specified options.
42 43 44 45 46 47 48 |
# File 'lib/vendored-middleman-deps/padrino-core-0.11.2/lib/padrino-core/server.rb', line 42 def start puts "=> Padrino/#{Padrino.version} has taken the stage #{Padrino.env} at http://#{[:Host]}:#{[:Port]}" [:INT, :TERM].each { |sig| trap(sig) { exit } } super ensure puts "<= Padrino leaves the gun, takes the cannoli" unless [:daemonize] end |