Class: RspecRunner::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec_runner/client.rb

Class Method Summary collapse

Class Method Details

.execute(*args) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/rspec_runner/client.rb', line 7

def execute(*args)
  DRb.start_service
  try_count = 0
  print 'Connecting... '

  while try_count < RspecRunner.configuration.client_timeout
    begin
      uri = fetch_uri
      raise DRb::DRbConnError unless uri

      runner = DRbObject.new_with_uri(uri)
      print 'running... '
      runner.execute(*args)
      puts 'done!'
      return true
    rescue DRb::DRbConnError
      try_count += 1
      sleep(1)
    end
  end

  puts 'Server is down :('
end