ceml 0.7.1 → 0.7.2

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 CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.7.2
data/ceml.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{ceml}
8
- s.version = "0.7.1"
8
+ s.version = "0.7.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Joe Edelman"]
@@ -24,7 +24,7 @@ module CEML
24
24
  end
25
25
 
26
26
  def stage_with_candidate candidate
27
- return :uninterested if @roles_to_cast.any?{ |r| r.casted.any?{ |guy| guy[:id] == candidate[:id] } }
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(&:full?)
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
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 7
8
- - 1
9
- version: 0.7.1
8
+ - 2
9
+ version: 0.7.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Joe Edelman