Class: Specjour::Dispatcher

Inherits:
Object
  • Object
show all
Includes:
SocketHelper
Defined in:
lib/specjour/dispatcher.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SocketHelper

#current_uri, #hostname, #ip_from_hostname, #local_ip, #new_uri

Constructor Details

#initialize(options = {}) ⇒ Dispatcher

Returns a new instance of Dispatcher.



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/specjour/dispatcher.rb', line 10

def initialize(options = {})
  Specjour.load_custom_hooks
  @options = options
  @project_path = options[:project_path]
  @test_paths = options[:test_paths]
  @worker_size = 0
  @managers = []
  @drb_connection_errors = Hash.new(0)
  @rsync_port = options[:rsync_port]
  @manager_threads = []
end

Instance Attribute Details

#drb_connection_errorsObject (readonly)

Returns the value of attribute drb_connection_errors.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def drb_connection_errors
  @drb_connection_errors
end

#hostsObject (readonly)

Returns the value of attribute hosts.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def hosts
  @hosts
end

#manager_threadsObject (readonly)

Returns the value of attribute manager_threads.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def manager_threads
  @manager_threads
end

#managersObject (readonly)

Returns the value of attribute managers.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def managers
  @managers
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def options
  @options
end

#project_pathObject

Returns the value of attribute project_path.



8
9
10
# File 'lib/specjour/dispatcher.rb', line 8

def project_path
  @project_path
end

#rsync_portObject (readonly)

Returns the value of attribute rsync_port.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def rsync_port
  @rsync_port
end

#test_pathsObject (readonly)

Returns the value of attribute test_paths.



7
8
9
# File 'lib/specjour/dispatcher.rb', line 7

def test_paths
  @test_paths
end

#worker_sizeObject

Returns the value of attribute worker_size.



8
9
10
# File 'lib/specjour/dispatcher.rb', line 8

def worker_size
  @worker_size
end

Instance Method Details

#startObject



22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/specjour/dispatcher.rb', line 22

def start
  abort("#{project_path} doesn't exist") unless File.directory?(project_path)
  gather_managers
  rsync_daemon.start
  dispatch_work
  if dispatching_tests?
    printer.start
  else
    wait_on_managers
  end
  exit printer.exit_status
end