Class: Bluepill::AppProxy

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

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app_name, options) ⇒ AppProxy

Returns a new instance of AppProxy.



8
9
10
# File 'lib/bluepill/dsl/app_proxy.rb', line 8

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.



6
7
8
# File 'lib/bluepill/dsl/app_proxy.rb', line 6

def app
  @app
end

Instance Method Details

#process(process_name, &process_block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/bluepill/dsl/app_proxy.rb', line 12

def process(process_name, &process_block)
  attributes = {}
  APP_ATTRIBUTES.each { |a| attributes[a] = 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