Class: EventedBluepill::AppProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/evented_bluepill/dsl/app_proxy.rb

Constant Summary collapse

APP_ATTRIBUTES =
[:working_dir, :uid, :gid, :environment]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name, options) ⇒ AppProxy

Returns a new instance of AppProxy.



13
14
15
# File 'lib/evented_bluepill/dsl/app_proxy.rb', line 13

def initialize(app_name, options)
  @app = Application.new(app_name.to_s, options)
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



11
12
13
# File 'lib/evented_bluepill/dsl/app_proxy.rb', line 11

def app
  @app
end

Instance Method Details

#process(process_name, &process_block) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/evented_bluepill/dsl/app_proxy.rb', line 17

def process(process_name, &process_block)
  attributes = {}
  APP_ATTRIBUTES.each {|a| attributes[a] = self.send(a) }

  process_factory = ProcessFactory.new(attributes, process_block)

  process = process_factory.create_process(process_name, @app.pids_dir)
  group = process_factory.attributes.delete(:group)

  @app.add_process(process, group)
end