chicanery 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +3 -1
- data/chicanery.gemspec +1 -0
- data/lib/chicanery.rb +1 -1
- data/lib/chicanery/debug.rb +12 -0
- data/lib/chicanery/handlers.rb +6 -0
- data/lib/chicanery/servers.rb +39 -8
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 10a2f31b2de883be54826b643b9bcdb8302f92d3
|
4
|
+
data.tar.gz: 18fca2caf13b57a4aa6a411f070a40ff64ae2517
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ecd3c65a9e6ca02735cda32d37b42d73428fb11f1f7d27b2f62f665befb512b3f49f73d9dee1e043bb3ffc4dc6b95088ce4f833554bfcc83f750b7b9ad006ed2
|
7
|
+
data.tar.gz: 6d956f8f614c256deecf00abcd28af7b588543e21a38e5248b177deca96861137ef7aeae5b97167df004f6a6c8687ff9b2723a698e3fe13f08041d66a26553f3
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,15 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
chicanery (0.1.
|
4
|
+
chicanery (0.1.8)
|
5
|
+
colorize (~> 0)
|
5
6
|
nokogiri (~> 1)
|
6
7
|
|
7
8
|
GEM
|
8
9
|
remote: https://rubygems.org/
|
9
10
|
specs:
|
10
11
|
addressable (2.3.6)
|
12
|
+
colorize (0.7.3)
|
11
13
|
crack (0.4.2)
|
12
14
|
safe_yaml (~> 1.0.0)
|
13
15
|
diff-lcs (1.2.5)
|
data/chicanery.gemspec
CHANGED
data/lib/chicanery.rb
CHANGED
data/lib/chicanery/handlers.rb
CHANGED
@@ -1,5 +1,10 @@
|
|
1
|
+
require 'chicanery/debug'
|
2
|
+
require 'colorize'
|
3
|
+
|
1
4
|
module Chicanery
|
2
5
|
module Handlers
|
6
|
+
include Debug
|
7
|
+
|
3
8
|
%w{run started succeeded failed broken fixed commit up down crashed recovered}.each do |status|
|
4
9
|
class_eval <<-EOF
|
5
10
|
def when_#{status} &block
|
@@ -11,6 +16,7 @@ module Chicanery
|
|
11
16
|
end
|
12
17
|
|
13
18
|
def notify_#{status}_handlers *args
|
19
|
+
verbose_blue \"\t\tnow #{status}\"
|
14
20
|
#{status}_handlers.each {|handler| handler.call *args }
|
15
21
|
end
|
16
22
|
EOF
|
data/lib/chicanery/servers.rb
CHANGED
@@ -1,36 +1,67 @@
|
|
1
1
|
require 'chicanery/collections'
|
2
2
|
require 'chicanery/handlers'
|
3
|
+
require 'chicanery/debug'
|
3
4
|
|
4
5
|
module Chicanery
|
5
6
|
module Servers
|
6
7
|
include Collections
|
7
8
|
include Handlers
|
9
|
+
include Debug
|
8
10
|
|
9
11
|
def check_servers current_state, previous_state
|
10
12
|
current_state[:servers] = {}
|
13
|
+
verbose_blue "Execution #{Time.now}"
|
11
14
|
servers.each do |server|
|
15
|
+
verbose "examining server #{server.name}"
|
12
16
|
current_jobs = server.jobs
|
13
|
-
|
17
|
+
if previous_state[:servers] && previous_state[:servers][server.name]
|
18
|
+
compare_jobs current_jobs, previous_state[:servers][server.name]
|
19
|
+
else
|
20
|
+
verbose "\tno past server #{server.name} state for comparison"
|
21
|
+
end
|
14
22
|
current_state[:servers][server.name] = current_jobs
|
15
23
|
end
|
16
24
|
end
|
17
25
|
|
18
26
|
def compare_jobs current_jobs, previous_jobs
|
19
|
-
return unless previous_jobs
|
20
27
|
current_jobs.each do |job_name, job|
|
21
|
-
|
28
|
+
verbose "\texamining job #{job_name} (now #{job[:activity]}, was #{job[:last_build_status]})"
|
29
|
+
if previous_jobs[job_name]
|
30
|
+
compare_job job_name, job, previous_jobs[job_name]
|
31
|
+
else
|
32
|
+
verbose "\tno past job #{job_name} state for comparison"
|
33
|
+
end
|
22
34
|
end
|
23
35
|
end
|
24
36
|
|
25
37
|
def compare_job name, current, previous
|
26
|
-
if current[:activity] == :building
|
27
|
-
|
38
|
+
if current[:activity] == :building
|
39
|
+
verbose "\t\tcurrently building"
|
40
|
+
hack_for_forgetful_ci current, previous
|
41
|
+
if previous[:activity] == :sleeping
|
42
|
+
notify_started_handlers name, current
|
43
|
+
end
|
44
|
+
return
|
28
45
|
end
|
29
|
-
|
46
|
+
unless current[:last_build_time] != previous[:last_build_time] || current[:last_build_status] != previous[:last_build_status]
|
47
|
+
verbose "\t\tno change in timestamp or build status"
|
48
|
+
return
|
49
|
+
end
|
50
|
+
verbose "\t\t#{previous[:last_build_status]} -> #{current[:last_build_status]}"
|
30
51
|
notify_succeeded_handlers name, current if current[:last_build_status] == :success
|
31
52
|
notify_failed_handlers name, current if current[:last_build_status] == :failure
|
32
|
-
notify_broken_handlers name, current if current[:last_build_status] == :failure
|
33
|
-
notify_fixed_handlers name, current if current[:last_build_status] == :success
|
53
|
+
notify_broken_handlers name, current if current[:last_build_status] == :failure && previous[:last_build_status] == :success
|
54
|
+
notify_fixed_handlers name, current if current[:last_build_status] == :success && previous[:last_build_status] == :failure
|
55
|
+
end
|
56
|
+
|
57
|
+
def hack_for_forgetful_ci current, previous
|
58
|
+
# the following unfortunate hack is to compensate for cctray implementations (semaphore) which lose last build information when building
|
59
|
+
return if current[:last_build_time] > 0
|
60
|
+
verbose "\t\tcopying previous build content"
|
61
|
+
%w(build_time build_status label).each do |property|
|
62
|
+
key = "last_#{property}".to_sym
|
63
|
+
current[key] = previous[key]
|
64
|
+
end
|
34
65
|
end
|
35
66
|
end
|
36
67
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: chicanery
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Ryall
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: colorize
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: rake
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +150,7 @@ files:
|
|
136
150
|
- lib/chicanery.rb
|
137
151
|
- lib/chicanery/cctray.rb
|
138
152
|
- lib/chicanery/collections.rb
|
153
|
+
- lib/chicanery/debug.rb
|
139
154
|
- lib/chicanery/git.rb
|
140
155
|
- lib/chicanery/handlers.rb
|
141
156
|
- lib/chicanery/persistence.rb
|