Sha256: 5c648f52f8943f4c43d1fffc2a648420c8f2228a8e6ad0e66428442b1ab38d7e

Contents?: true

Size: 1.14 KB

Versions: 39

Compression:

Stored size: 1.14 KB

Contents

module Excon
  module Test
    module Plugin
      module Server
        module Unicorn
          def start(app_str = app, bind_uri = bind)
            bind_uri = URI.parse(bind_uri) unless bind_uri.is_a? URI::Generic
            is_unix_socket = (bind_uri.scheme == "unix")
            if is_unix_socket
              bind_str = bind_uri.to_s
            else
              host = bind_uri.host.gsub(/[\[\]]/, '')
              bind_str = "#{host}:#{bind_uri.port}"
            end
            args = [ 
              RbConfig.ruby,
              '-S',
              'unicorn', 
              '--no-default-middleware', 
              '-l',
              bind_str,  
              app_str
            ]
            open_process(*args)
            process_stderr = ''
            line = ''
            until line =~ /worker\=0 ready/
              line = error.gets
              raise process_stderr if line.nil?
              process_stderr << line
              fatal_time = elapsed_time > timeout
              raise 'unicorn server has taken too long to start' if fatal_time
            end
            true
          end
        end
      end
    end
  end
end

Version data entries

39 entries across 39 versions & 2 rubygems

Version Path
excon-1.2.2 lib/excon/test/plugin/server/unicorn.rb
excon-1.2.1 lib/excon/test/plugin/server/unicorn.rb
excon-1.2.0 lib/excon/test/plugin/server/unicorn.rb
excon-1.1.1 lib/excon/test/plugin/server/unicorn.rb
excon-1.1.0 lib/excon/test/plugin/server/unicorn.rb
excon-1.0.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.112.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.111.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.110.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.109.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.108.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.107.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.106.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.105.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.104.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.103.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.102.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.101.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.100.0 lib/excon/test/plugin/server/unicorn.rb
excon-0.99.0 lib/excon/test/plugin/server/unicorn.rb