Module: Scales::Server

Defined in:
lib/scales-server.rb,
lib/scales-server/base.rb,
lib/scales-server/proxy.rb,
lib/scales-server/server.rb,
lib/scales-server/status.rb,
lib/scales-server/version.rb,
lib/scales-server/dispatch.rb,
lib/scales-server/content_type.rb,
lib/scales-server/dispatch/job.rb,
lib/scales-server/proxy/backend.rb,
lib/scales-server/dispatch/lookup.rb,
lib/scales-server/proxy/callbacks.rb,
lib/scales-server/dispatch/enqueue.rb,
lib/scales-server/dispatch/request.rb,
lib/scales-server/dispatch/response.rb

Defined Under Namespace

Modules: Dispatch, Proxy Classes: ContentType, Server, Status

Constant Summary collapse

VERSION =
"0.0.4"
@@status =
nil

Class Method Summary collapse

Class Method Details

.run!Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/scales-server/base.rb', line 5

def run!
  ARGV << "--environment" << "#{Scales.env}"
  
  server      = Server.new
  @runner      = Goliath::Runner.new(ARGV, server)
  @runner.app  = Goliath::Rack::Builder.build(Server, server)
  @runner.load_plugins(Server.plugins)
  
  status = Status.new(@runner.address, @runner.port)
  status.start!
  Scales::Server.status = status
  
  @pid ||= Process.pid
  at_exit{ status.stop! if !@runner.daemonize or Process.pid != @pid }
  
  @runner.run
end

.statusObject



24
25
26
# File 'lib/scales-server/base.rb', line 24

def status
  @@status
end

.status=(status) ⇒ Object



28
29
30
# File 'lib/scales-server/base.rb', line 28

def status=(status)
  @@status = status
end