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, #new_uri

Constructor Details

- (Dispatcher) initialize(options = {})



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

- (Object) drb_connection_errors (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

- (Object) hosts (readonly)

Returns the value of attribute hosts



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

def hosts
  @hosts
end

- (Object) manager_threads (readonly)

Returns the value of attribute manager_threads



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

def manager_threads
  @manager_threads
end

- (Object) managers (readonly)

Returns the value of attribute managers



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

def managers
  @managers
end

- (Object) options (readonly)

Returns the value of attribute options



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

def options
  @options
end

- (Object) project_path

Returns the value of attribute project_path



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

def project_path
  @project_path
end

- (Object) rsync_port (readonly)

Returns the value of attribute rsync_port



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

def rsync_port
  @rsync_port
end

- (Object) test_paths (readonly)

Returns the value of attribute test_paths



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

def test_paths
  @test_paths
end

- (Object) worker_size

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

- (Object) start



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