Class: Daikon::Server

Inherits:
Object
  • Object
show all
Defined in:
lib/daikon/server.rb

Class Method Summary collapse

Class Method Details

.start(logger, port) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/daikon/server.rb', line 3

def self.start(logger, port)
  fork do
    require 'webrick'
    server = WEBrick::HTTPServer.new :Logger => logger, :Port => port
    server.mount_proc('/') do |req, resp|
      resp.body = <<-HTML
            <a href='http://radishapp.com'>Radish: Dig deep into Redis.</a>
            <br />
            Running Daikon v#{VERSION}
            HTML
    end
    trap('INT')  { server.stop }
    trap('TERM') { server.stop }
    server.start
  end
end