Sha256: 8950efb8f9be5e07f661988694e16a518b8ed27ab705b3c3296ab51e9f097158

Contents?: true

Size: 826 Bytes

Versions: 1

Compression:

Stored size: 826 Bytes

Contents

require 'heroku/forward/backends/base'

module Heroku
  module Forward
    module Backends
      class Unicorn < Base
        attr_accessor :config_file

        def initialize(options = {})
          @application = options[:application]
          @socket = options[:socket] || Heroku::Forward::Utils::Dir.tmp_filename('unicorn-', '.sock')
          @env = options[:env] || 'development'
          @config_file = options[:config_file]
        end

        def spawn!
          return false if spawned?
          check!

          args = ['unicorn']
          args.push '--env', @env
          args.push '--config-file', @config_file if @config_file
          args.push '--listen', @socket
          args.push @application

          @pid = Spoon.spawnp(*args)
          @spawned = true
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
heroku-forward-0.4.0 lib/heroku/forward/backends/unicorn.rb