Class Sinatra::Server
In: lib/sinatra/server.rb
Parent: Object

Methods

start  

Public Instance methods

[Source]

    # File lib/sinatra/server.rb, line 10
10:     def start
11:       begin
12:         tail_thread = tail(Options.log_file)
13:         Rack::Handler::Mongrel.run(Sinatra::Session::Cookie.new(Dispatcher.new), :Port => Options.port) do |server|
14:           puts "== Sinatra has taken the stage on port #{server.port}!"
15:           trap("INT") do
16:             server.stop
17:             self.class.running = false
18:             puts "\n== Sinatra has ended his set (crowd applauds)"
19:           end
20:         end
21:         self.class.running = true
22:       rescue Errno::EADDRINUSE => e
23:         puts "== Someone is already performing on port #{Options.port}!"
24:         logger.exception e
25:       rescue => e
26:         logger.exception e
27:       ensure
28:         tail_thread.kill if tail_thread
29:       end
30:     end

[Validate]