ceml 0.7.1 → 0.7.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/ceml.gemspec +1 -1
- data/lib/ceml/confluence.rb +13 -1
- data/lib/ceml/driver.rb +12 -1
- data/lib/ceml/role.rb +5 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.7.
|
1
|
+
0.7.2
|
data/ceml.gemspec
CHANGED
data/lib/ceml/confluence.rb
CHANGED
@@ -24,7 +24,7 @@ module CEML
|
|
24
24
|
end
|
25
25
|
|
26
26
|
def stage_with_candidate candidate
|
27
|
-
return :uninterested if
|
27
|
+
return :uninterested if cast_with?(candidate)
|
28
28
|
best_role = best_role_for(candidate)
|
29
29
|
return :uninterested unless best_role
|
30
30
|
return :joinable if launched?
|
@@ -44,6 +44,18 @@ module CEML
|
|
44
44
|
@roles_to_cast.all?{ |role| role.allowed == 0 }
|
45
45
|
end
|
46
46
|
|
47
|
+
def over?
|
48
|
+
@roles_to_cast.any?{ |r| r.over?(star) }
|
49
|
+
end
|
50
|
+
|
51
|
+
def cast_with?(candidate)
|
52
|
+
@roles_to_cast.any?{ |r| r.casted.any?{ |guy| guy[:id] == candidate[:id] } }
|
53
|
+
end
|
54
|
+
|
55
|
+
def live_with?(candidate)
|
56
|
+
launched? and cast_with?(candidate)
|
57
|
+
end
|
58
|
+
|
47
59
|
def cast
|
48
60
|
@roles_to_cast.map{ |r| r.casted }.flatten
|
49
61
|
end
|
data/lib/ceml/driver.rb
CHANGED
@@ -62,8 +62,15 @@ module CEML
|
|
62
62
|
def ping script_collection_id, roleset, candidate
|
63
63
|
return unless roleset.any?{ |r| r.fits? candidate }
|
64
64
|
candidate[:ts] = CEML.clock
|
65
|
+
already_launched_with = nil
|
65
66
|
|
66
67
|
with_confluences script_collection_id, roleset do |confluences|
|
68
|
+
live_with = confluences.select{ |c| c.live_with?(candidate) }
|
69
|
+
if not live_with.empty?
|
70
|
+
already_launched_with = live_with.incident_id
|
71
|
+
break
|
72
|
+
end
|
73
|
+
|
67
74
|
locs = confluences.group_by{ |l| l.stage_with_candidate(candidate) }
|
68
75
|
if locs[:joinable]
|
69
76
|
log "joining..."
|
@@ -95,7 +102,11 @@ module CEML
|
|
95
102
|
end
|
96
103
|
confluences << c
|
97
104
|
end
|
98
|
-
confluences.delete_if(&:
|
105
|
+
confluences.delete_if(&:over?)
|
106
|
+
end
|
107
|
+
|
108
|
+
if already_launched_with
|
109
|
+
push already_launched_with, nil, candidate
|
99
110
|
end
|
100
111
|
end
|
101
112
|
|
data/lib/ceml/role.rb
CHANGED
@@ -29,6 +29,11 @@ module CEML
|
|
29
29
|
def needed; [range.min - casted.size, 0].max; end
|
30
30
|
def allowed; [range.max - casted.size, 0].max; end
|
31
31
|
|
32
|
+
def over?(star)
|
33
|
+
return unless criteria.timewindow and star
|
34
|
+
CEML.clock - star[:ts] > criteria.timewindow
|
35
|
+
end
|
36
|
+
|
32
37
|
def fits?(candidate, star = nil)
|
33
38
|
return false unless criteria =~ candidate
|
34
39
|
return false if casted.size >= range.max
|