Sha256: 005870d1f0cb52437b795bbecc731cf54d7ab806b3d671a3d9c3f5c78541f724

Contents?: true

Size: 765 Bytes

Versions: 3

Compression:

Stored size: 765 Bytes

Contents

# -*- encoding: utf-8 -*-

require 'evented_bluepill/application'
require 'evented_bluepill/dsl/process_factory'

module EventedBluepill
  class AppProxy
    APP_ATTRIBUTES = [:working_dir, :uid, :gid, :environment]

    attr_accessor *APP_ATTRIBUTES
    attr_reader :app

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

    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
evented_bluepill-0.0.52 lib/evented_bluepill/dsl/app_proxy.rb
evented_bluepill-0.0.51 lib/evented_bluepill/dsl/app_proxy.rb
evented_bluepill-0.0.50 lib/evented_bluepill/dsl/app_proxy.rb