class MixpanelTesting::LocalSiteProvider
Public Class Methods
new(cmd, uri)
click to toggle source
# File lib/mixpaneltesting/localsite.rb, line 8 def initialize(cmd, uri) @cmd = cmd @uri = uri @timeout = Settings.timeout @log = Logger.new(STDOUT) @pid = nil end
Public Instance Methods
kill()
click to toggle source
# File lib/mixpaneltesting/localsite.rb, line 27 def kill return nil if @pid.nil? @log.info "Killing subprocess with localsite" Process.kill('KILL', @pid) end
ready?()
click to toggle source
# File lib/mixpaneltesting/localsite.rb, line 33 def ready? !Excon.get(@uri).status.nil? rescue false end
start()
click to toggle source
# File lib/mixpaneltesting/localsite.rb, line 16 def start @pid = Process.spawn @cmd puts "Spawn #{@cmd} with pid #{@pid}" (1..@timeout).each { |i| sleep 1 break if ready? } @log.info "Site should be available on #{@uri}" end