File: puma.rb

package info (click to toggle)
ruby-excon 1.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,240 kB
  • sloc: ruby: 7,970; makefile: 5
file content (23 lines) | stat: -rw-r--r-- 658 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
module Excon
  module Test
    module Plugin
      module Server
        module Puma
          def start(app_str = app, bind_uri = bind)
            open_process(RbConfig.ruby, '-S', 'puma', '-b', bind_uri.to_s, app_str)
            process_stderr = ""
            line = ''
            until line.include?('Use Ctrl-C to stop')
              line = read.gets
              raise process_stderr if line.nil?
              process_stderr << line
              fatal_time = elapsed_time > timeout
              raise 'puma server has taken too long to start' if fatal_time
            end
            true
          end
        end
      end
    end
  end
end