specjour 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/bin/specjour +5 -1
- data/lib/specjour/dispatcher.rb +7 -2
- data/lib/specjour/manager.rb +10 -4
- data/lib/specjour/printer.rb +0 -4
- data/lib/specjour.rb +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.6
|
data/bin/specjour
CHANGED
@@ -15,6 +15,10 @@ optparse = OptionParser.new do |opts|
|
|
15
15
|
options[:batch_size] = n
|
16
16
|
end
|
17
17
|
|
18
|
+
opts.on('-d', '--dispatcher HOSTNAME', "Only run specs from the dispatcher running on this host, i.e. farnsworth.local") do |name|
|
19
|
+
options[:registered_dispatcher] = name
|
20
|
+
end
|
21
|
+
|
18
22
|
opts.on('--do-work OPTIONS', Array, 'INTERNAL USE ONLY') do |args|
|
19
23
|
specs_to_run = args[3..-1]
|
20
24
|
options[:worker_args] = args[0], args[1], args[2], specs_to_run
|
@@ -37,5 +41,5 @@ if options[:worker_args]
|
|
37
41
|
options[:worker_args] << options[:batch_size]
|
38
42
|
Specjour::Worker.new(*options[:worker_args]).run
|
39
43
|
else
|
40
|
-
Specjour::Manager.new(options
|
44
|
+
Specjour::Manager.new(options).start
|
41
45
|
end
|
data/lib/specjour/dispatcher.rb
CHANGED
@@ -60,7 +60,7 @@ module Specjour
|
|
60
60
|
|
61
61
|
def fetch_manager(uri)
|
62
62
|
manager = DRbObject.new_with_uri(uri.to_s)
|
63
|
-
|
63
|
+
if !managers.include?(manager) && manager.available_for?(hostname)
|
64
64
|
set_up_manager(manager, uri)
|
65
65
|
managers << manager
|
66
66
|
self.worker_size += manager.worker_size
|
@@ -78,9 +78,14 @@ module Specjour
|
|
78
78
|
browser.stop unless reply.flags.more_coming?
|
79
79
|
end
|
80
80
|
puts "Managers found: #{managers.size}"
|
81
|
+
abort unless managers.size > 0
|
81
82
|
printer.worker_size = worker_size
|
82
83
|
end
|
83
84
|
|
85
|
+
def hostname
|
86
|
+
@hostname ||= Socket.gethostname
|
87
|
+
end
|
88
|
+
|
84
89
|
def printer
|
85
90
|
@printer ||= Printer.new.start
|
86
91
|
end
|
@@ -107,7 +112,7 @@ module Specjour
|
|
107
112
|
|
108
113
|
def set_up_manager(manager, uri)
|
109
114
|
manager.project_name = project_name
|
110
|
-
manager.dispatcher_uri = URI::Generic.build :scheme => "specjour", :host =>
|
115
|
+
manager.dispatcher_uri = URI::Generic.build :scheme => "specjour", :host => hostname, :port => printer.port
|
111
116
|
end
|
112
117
|
|
113
118
|
def sync_managers
|
data/lib/specjour/manager.rb
CHANGED
@@ -3,13 +3,19 @@ module Specjour
|
|
3
3
|
require 'dnssd'
|
4
4
|
include DRbUndumped
|
5
5
|
|
6
|
-
attr_accessor :project_name, :specs_to_run, :dispatcher_uri
|
6
|
+
attr_accessor :project_name, :specs_to_run, :dispatcher_uri
|
7
|
+
attr_reader :worker_size, :batch_size, :registered_dispatcher, :bonjour_service
|
7
8
|
|
8
|
-
def initialize(
|
9
|
-
@worker_size = worker_size
|
10
|
-
@batch_size = batch_size
|
9
|
+
def initialize(options = {})
|
10
|
+
@worker_size = options[:worker_size]
|
11
|
+
@batch_size = options[:batch_size]
|
12
|
+
@registered_dispatcher = options[:registered_dispatcher]
|
11
13
|
end
|
12
14
|
|
15
|
+
def available_for?(hostname)
|
16
|
+
registered_dispatcher ? registered_dispatcher == hostname : true
|
17
|
+
end
|
18
|
+
|
13
19
|
def bundle_install
|
14
20
|
Dir.chdir(project_path) do
|
15
21
|
unless system('bundle check > /dev/null')
|
data/lib/specjour/printer.rb
CHANGED
data/lib/specjour.rb
CHANGED