Sha256: 93419ee5920c217ac002372f0098cd41d9d4b441ff4302a9a3b21dfd73165979

Contents?: true

Size: 742 Bytes

Versions: 1

Compression:

Stored size: 742 Bytes

Contents

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

require 'bluepill/application'
require 'bluepill/dsl/process_factory'

module Bluepill
  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

1 entries across 1 versions & 1 rubygems

Version Path
evented_bluepill-0.0.47 lib/bluepill/dsl/app_proxy.rb