Class: Offshore::Suite

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

Instance Method Summary collapse

Instance Method Details

#all_hosts!(method, *args) ⇒ Object



11
12
13
14
15
# File 'lib/offshore/client/suite.rb', line 11

def all_hosts!(method, *args)
  hosts.each do |host|
    host.send(method, *args)
  end
end

#defaultObject



7
8
9
# File 'lib/offshore/client/suite.rb', line 7

def default
  hosts.first
end

#hostsObject



3
4
5
# File 'lib/offshore/client/suite.rb', line 3

def hosts
  @hosts ||= []
end

#start(server_array_or_hash) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/offshore/client/suite.rb', line 17

def start(server_array_or_hash)
  server_array = server_array_or_hash.is_a?(Array) ? server_array_or_hash : [server_array_or_hash]
  raise "Need one server" if server_array.size != 1
  
  server_array.each do |hash|
    hosts << Host.new(hash)
  end
  
  all_hosts!(:suite_start)
end

#stopObject



28
29
30
31
# File 'lib/offshore/client/suite.rb', line 28

def stop
  Test.flush # if the last one failed this will stop it
  all_hosts!(:suite_stop)
end