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.



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

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.



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

def app
  @app
end

Instance Method Details

#process(process_name, &process_block) ⇒ Object



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

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