Class: SnowmanIO::Launcher

Inherits:
Object
  • Object
show all
Includes:
Celluloid
Defined in:
lib/snowman-io/launcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Launcher

Returns a new instance of Launcher.



5
6
7
# File 'lib/snowman-io/launcher.rb', line 5

def initialize(options)
  @options = options
end

Instance Method Details

#startObject



9
10
11
12
13
14
15
16
# File 'lib/snowman-io/launcher.rb', line 9

def start
  Migration.new.migrate
  app = Rack::Cascade.new [API::Root, Web]
  @web_server = WebServer.supervise_as(:web_server, app, @options.slice(:port, :host, :verbose))
  @main = Loop::Main.supervise_as(:main)
  @checks = Loop::Checks.supervise_as(:checks)
  @spiders = Loop::Spiders.supervise_as(:checks)
end

#stopObject



18
19
20
21
22
23
# File 'lib/snowman-io/launcher.rb', line 18

def stop
  @spiders.terminate
  @checks.terminate
  @main.terminate
  @web_server.terminate # TODO: shutdown blocking?
end