Merge branch 'master' of github.com:sinatra/sinatra
This commit is contained in:
commit
f6040135dc
|
@ -1520,6 +1520,7 @@ ohne dass sie einer Konstanten zugeordnet werden. Dies lässt sich mit
|
|||
|
||||
Die Applikation kann mit Hilfe eines optionalen Parameters erstellt werden:
|
||||
|
||||
# config.ru
|
||||
require 'sinatra/base'
|
||||
|
||||
controller = Sinatra.new do
|
||||
|
|
|
@ -1581,6 +1581,7 @@ esto tenés <tt>Sinatra.new</tt>:
|
|||
Acepta como argumento opcional una aplicación desde la que se
|
||||
heredará:
|
||||
|
||||
# config.ru
|
||||
require 'sinatra/base'
|
||||
|
||||
controller = Sinatra.new do
|
||||
|
|
|
@ -1585,6 +1585,7 @@ sans avoir à les assigner à une constante, vous pouvez le faire grâce à
|
|||
|
||||
L'application dont elle hérite peut être passé en argument optionnel :
|
||||
|
||||
# config.ru
|
||||
require 'sinatra/base'
|
||||
|
||||
controleur = Sinatra.new do
|
||||
|
|
|
@ -1519,6 +1519,7 @@ Rack-совместимый сервер приложений.
|
|||
Этот метод может принимать аргументом приложение, от которого
|
||||
следует наследоваться:
|
||||
|
||||
# config.ru
|
||||
require 'sinatra/base'
|
||||
|
||||
controller = Sinatra.new do
|
||||
|
|
|
@ -1188,16 +1188,20 @@ module Sinatra
|
|||
end
|
||||
|
||||
# Run the Sinatra app as a self-hosted server using
|
||||
# Thin, Mongrel or WEBrick (in that order)
|
||||
# Thin, Mongrel or WEBrick (in that order). If given a block, will call
|
||||
# with the constructed handler once we have taken the stage.
|
||||
def run!(options={})
|
||||
set options
|
||||
handler = detect_rack_handler
|
||||
handler_name = handler.name.gsub(/.*::/, '')
|
||||
$stderr.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, :Host => bind, :Port => port do |server|
|
||||
unless handler_name =~ /cgi/i
|
||||
$stderr.puts "== Sinatra/#{Sinatra::VERSION} has taken the stage " +
|
||||
"on #{port} for #{environment} with backup from #{handler_name}"
|
||||
end
|
||||
[:INT, :TERM].each { |sig| trap(sig) { quit!(server, handler_name) } }
|
||||
set :running, true
|
||||
yield handler if block_given?
|
||||
end
|
||||
rescue Errno::EADDRINUSE => e
|
||||
$stderr.puts "== Someone is already performing on port #{port}!"
|
||||
|
|
Loading…
Reference in New Issue