Method: Server.start
- Defined in:
- lib/server.rb
.start(options = {}) ⇒ Object
Starts the Sinatra server, and kills the processes when shutdown
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 |
# File 'lib/server.rb', line 86 def self.start(={}) @options = @options[:redis_options] = {} unless @options.has_key? :redis_options unless Server.running? if @options[:run_as_server] puts "Starting Sinatra for cobweb v#{Cobweb.version}" Server.run! puts "Stopping crawl..." else thread = Thread.new do puts "Starting Sinatra" Server.run! puts "Stopping crawl..." ## we need to manually kill the main thread as sinatra traps the interrupts Thread.main.kill end end end end |