Sha256: e04ad2bbfc59f9a3df7eef0f3255a3de56cb4b37f7efab8d773f8965742517ca

Contents?: true

Size: 893 Bytes

Versions: 2

Compression:

Stored size: 893 Bytes

Contents

require 'rackjour'

module Rackjour
  class Server
    attr_reader :target

    def initialize(target, version, tar, config)
      @target = target
      log 'initialize'

      @tar = tar
      @config = config
      @version = version
      @apps = []
      @deployed = false

      DRb.start_service
      @conn = "druby://#{@target}:#{WORKER_PORT}"
      @drb = DRbObject.new_with_uri(@conn)

      @drb.setup(@version, @tar, @config)
    end

    def deployed?
      @deployed
    end

    def add_apps(apps, terminator)
      (apps - [terminator]).each do |app|
        log "job: #{@version} #{app}"
        @drb.add_app(app)
      end
      log "job: #{@version} #{terminator} (terminator)"
      @drb.add_terminator(terminator)
      @deployed = true
    end

    def call(app, env)
      @drb.call(app, env)
    end

    def log(str)
      puts "#{@target}: #{str}"
    end
  end
end

Version data entries

2 entries across 1 versions & 1 rubygems

Version Path
rackjour-0.1.8 lib/rackjour/server.rb
rackjour-0.1.8 vendor/gems/gems/rackjour-0.1.5/lib/rackjour/server.rb