Class: Juici::App

Inherits:
Object
  • Object
show all
Defined in:
lib/juici/app.rb

Constant Summary collapse

@@watchers =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ App

Returns a new instance of App.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/juici/app.rb', line 22

def initialize(opts={})
  @opts = opts
  # NOTE: this happening before we start a build queue is important, it
  # means we can't start any more workers and get tied in knots
  # clear_stale_children
  #
  # Urgh
  init_build_queue
  reload_unfinished_work
  start_workers
end

Instance Attribute Details

#optsObject (readonly)

Returns the value of attribute opts.



21
22
23
# File 'lib/juici/app.rb', line 21

def opts
  @opts
end

Class Method Details

.shutdownObject



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/juici/app.rb', line 9

def self.shutdown
  ::Juici.dbgp "Shutting down Juici"
  @@watchers.each do |watcher|
    ::Juici.dbgp "Killing #{watcher.inspect}"
    watcher.kill
    watcher.join
    ::Juici.dbgp "Dead:   #{watcher.inspect}"
  end

  shutdown_build_queue
end

Instance Method Details

#spawn_watcherObject



34
35
36
# File 'lib/juici/app.rb', line 34

def spawn_watcher
  @@watchers << Watcher.start!
end