Method: Sinatra::Base.run!
- Defined in:
- lib/sinatra/base.rb
.run!(options = {}, &block) ⇒ Object Also known as: start!
Run the Sinatra app as a self-hosted server using Puma, Falcon (in that order). If given a block, will call with the constructed handler once we have taken the stage.
1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 |
# File 'lib/sinatra/base.rb', line 1610 def run!( = {}, &block) unless defined?(Rackup::Handler) rackup_warning = " Sinatra could not start, the required gems weren't found!\n\n Add them to your bundle with:\n\n bundle add rackup puma\n\n or install them with:\n\n gem install rackup puma\n\n MISSING_RACKUP\n warn rackup_warning\n exit 1\n end\n\n return if running?\n\n set options\n handler = Rackup::Handler.pick(server)\n handler_name = handler.name.gsub(/.*::/, '')\n server_settings = settings.respond_to?(:server_settings) ? settings.server_settings : {}\n server_settings.merge!(Port: port, Host: bind)\n\n begin\n start_server(handler, server_settings, handler_name, &block)\n rescue Errno::EADDRINUSE\n warn \"== Someone is already performing on port \#{port}!\"\n raise\n ensure\n quit!\n end\nend\n" |