kitchen_hooks 1.5.1 → 1.5.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fdb2a72a6956b35d41937cde0cee3be69ad832f2
4
- data.tar.gz: 8f033c77c713dee2abe2ef435b7ef2d01645bdc6
3
+ metadata.gz: cf6b444d973aa69f4eaf3bf79ccacca65e717149
4
+ data.tar.gz: fcdb939b53fc35a04eb18eaad4cb52ce81166304
5
5
  SHA512:
6
- metadata.gz: 9ab833ecddff610020cec29609480d136514a069425a16ab9daaa941c9de9453e5fc5b380a5a5b9bbe72b9a62b5ccc85ce44431f7c48ee9aaa3b42d3ea810dd6
7
- data.tar.gz: cbea2a4672b06e4e096e335e7e2efd2220944bc59e1504f6ddd774a81d622cef6993029e76cade61722f43d5999c9725f4fd1ac44d148dc7ff42e60ba57425ce
6
+ metadata.gz: 935caae8b512c4e1607840cf428778fdf94914c70107e73b5f7df50e23d00d44c5430656e0013ed081c32dbaf320881d4625b413b3c1a9e5c9844885fb37179c
7
+ data.tar.gz: 7ebdc2ebc6cf361a74305547cb455313da6a1c67bfe202af2524a90e65820387800ff5212a3cb86500ad4b98146447e2de3ce537064a9eeecb112aa1095de274
data/.gitignore CHANGED
@@ -13,4 +13,5 @@
13
13
  .yardoc
14
14
  doc
15
15
  pkg
16
- tmp
16
+ tmp
17
+ Gemfile.lock
data/Readme.md CHANGED
@@ -38,6 +38,7 @@ Use the `server` command to start the WebHook receiver:
38
38
 
39
39
  ### 1.5
40
40
 
41
+ * Add release notifications
41
42
  * Add indication of success or failure
42
43
  * Only upload on commits to Kitchen `master` branch
43
44
  * Add custom timeline icons to distinguish event types
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.5.1
1
+ 1.5.2
@@ -36,9 +36,10 @@ module KitchenHooks
36
36
 
37
37
 
38
38
  get '/' do
39
+ process_release
39
40
  db_entries = {}
40
41
  db.each do |k, v|
41
- db_entries[k] = v
42
+ db_entries[k] = v unless k == 'meta'
42
43
  end
43
44
  erb :app, locals: {
44
45
  database: db_entries.sort_by { |stamp, _| stamp }
@@ -64,21 +65,30 @@ module KitchenHooks
64
65
  end
65
66
 
66
67
 
68
+
67
69
  private
70
+
68
71
  def knives ; @@knives ||= [] end
69
72
 
70
73
  def db ; @@db end
71
74
 
72
- def hipchat message, color='green', notify=false
75
+ def hipchat message, color
73
76
  return if @@hipchat.nil?
74
77
  @@hipchat[@@hipchat_room].send @@hipchat_nick, message, \
75
- color: color, notify: notify, message_format: 'html'
78
+ color: color, notify: false, message_format: 'html'
76
79
  end
77
80
 
81
+
78
82
  def notify entry
79
- hipchat notification(entry)
83
+ color = case entry[:type]
84
+ when 'failure' ; 'red'
85
+ when 'release' ; 'purple'
86
+ else ; 'green'
87
+ end
88
+ hipchat notification(entry), color
80
89
  end
81
90
 
91
+
82
92
  # error == nil => success
83
93
  # error == false => nop
84
94
  # otherwise => failure
@@ -93,6 +103,17 @@ module KitchenHooks
93
103
  notify entry
94
104
  end
95
105
 
106
+
107
+ def process_release version=KitchenHooks::VERSION
108
+ db['meta'] ||= {}
109
+ return if db['meta']['version'] == version
110
+ mark version, 'release'
111
+ db.synchronize do
112
+ db['meta']['version'] = version
113
+ end
114
+ db.flush
115
+ end
116
+
96
117
  def process event
97
118
  if event.nil? # JSON parse failed
98
119
  mark event, 'failure', 'Could not parse WebHook payload'
@@ -170,9 +170,11 @@ module KitchenHooks
170
170
  when 'kitchen upload'
171
171
  %Q| <i>#{author(event)}</i> updated <a href="#{gitlab_url(event)}">the Kitchen</a> |
172
172
  when 'cookbook upload'
173
- %Q| <i>#{author(event)}</i> released <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> of <a href="#{gitlab_url(event)}">#{repo_name(event)}</a> |
173
+ %Q| <i>#{author(event)}</i> released <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> of <a href="#{gitlab_url(event)}">#{cookbook_name(event)}</a> |
174
174
  when 'constraint application'
175
- %Q| <i>#{author(event)}</i> constrained <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> with <a href="#{gitlab_url(event)}">#{repo_name(event)}</a> |
175
+ %Q| <i>#{author(event)}</i> constrained <a href="#{gitlab_tag_url(event)}">#{tag_name(event)}</a> with <a href="#{gitlab_url(event)}">#{cookbook_name(event)}</a> |
176
+ when 'release'
177
+ %Q| Kitchen Hooks <b>v#{event}</b> released! |
176
178
  end.strip
177
179
  end
178
180
 
@@ -10,6 +10,10 @@ body {
10
10
  background: #d9534f;
11
11
  }
12
12
 
13
+ .release .cd-timeline-img {
14
+ background: #5bc0de;
15
+ }
16
+
13
17
  .cd-timeline-content {
14
18
  color: #4e5d6c;
15
19
  }
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0"?>
2
+ <svg width="512" height="512" xmlns="http://www.w3.org/2000/svg">
3
+
4
+ <g>
5
+ <title>background</title>
6
+ <rect fill="none" id="canvas_background" height="402" width="582" y="-1" x="-1"/>
7
+ </g>
8
+ <g>
9
+ <title>Layer 1</title>
10
+ <path fill="#ffffff" d="m253.897766,53.210709l188.147552,103.745026l0,202.358688l-188.045319,100.327362l-188.045334,-100.327362l0,-203.59285l187.9431,-102.510864zm0.102234,-47.664927l-229.834,125.363551l0,253.460754l229.834,122.629913l229.833984,-122.629913l0,-252.092728l-229.833984,-126.731578zm0,100.226336l-146.257904,77.372459l0,147.848618l146.257904,75.006378l146.256653,-75.006378l0,-147.042908l-146.256653,-78.178169zm75.943542,87.972359l-75.740311,38.941818l-74.964951,-40.084686l74.659485,-39.50293l76.045776,40.645798zm-180.413986,30.351364l83.576111,44.695145l0,79.545013l-83.576111,-42.879211l0,-81.360947zm125.363541,124.241348l0,-79.321045l83.577332,-42.960724l0,79.402618l-83.577332,42.87915z" id="cube-9-icon"/>
11
+ </g>
12
+ </svg>
data/web/views/app.erb CHANGED
@@ -14,6 +14,8 @@
14
14
  <img src="/vendor/img/shield.svg" alt="Shield">
15
15
  <% when 'failure' %>
16
16
  <img src="/vendor/img/error.svg" alt="Error">
17
+ <% when 'release' %>
18
+ <img src="/vendor/img/cube.svg" alt="Cube">
17
19
  <% end %>
18
20
  </div>
19
21
  <div class="cd-timeline-content">
@@ -22,6 +24,8 @@
22
24
  <p><%= notification entry %>. Triggered when <%= generic_details(entry[:event]) %></p>
23
25
  <% elsif entry[:error] # Failed before event generated %>
24
26
  <p><%= notification entry %></p>
27
+ <% elsif type == 'release' %>
28
+ <p><%= notification entry %></p>
25
29
  <% else %>
26
30
  <p><%= notification entry %> by pushing <%= push_details(entry[:event]) %></p>
27
31
  <% end %>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen_hooks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.1
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kelly Wong
@@ -145,7 +145,6 @@ extra_rdoc_files: []
145
145
  files:
146
146
  - ".gitignore"
147
147
  - Gemfile
148
- - Gemfile.lock
149
148
  - LICENSE
150
149
  - Rakefile
151
150
  - Readme.md
@@ -165,7 +164,7 @@ files:
165
164
  - web/public/vendor/css/superhero-v3.3.0.css
166
165
  - web/public/vendor/css/vertical-timeline-v1.0.0.css
167
166
  - web/public/vendor/img/book.svg
168
- - web/public/vendor/img/cd-icon.svg
167
+ - web/public/vendor/img/cube.svg
169
168
  - web/public/vendor/img/cutlery.svg
170
169
  - web/public/vendor/img/error.svg
171
170
  - web/public/vendor/img/shield.svg
data/Gemfile.lock DELETED
@@ -1,220 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- kitchen_hooks (1.5.0)
5
- berkshelf (~> 3)
6
- chef (~> 11.16.4)
7
- daybreak (~> 0.3)
8
- git (~> 1.2)
9
- hipchat (~> 1)
10
- retryable (~> 1)
11
- ridley (~> 4.1)
12
- sinatra (~> 1.4)
13
- thor (~> 0)
14
-
15
- GEM
16
- remote: https://rubygems.org/
17
- specs:
18
- addressable (2.3.6)
19
- arr-pm (0.0.9)
20
- cabin (> 0)
21
- backports (3.6.4)
22
- berkshelf (3.2.1)
23
- addressable (~> 2.3.4)
24
- berkshelf-api-client (~> 1.2)
25
- buff-config (~> 1.0)
26
- buff-extensions (~> 1.0)
27
- buff-shell_out (~> 0.1)
28
- celluloid (~> 0.16.0)
29
- celluloid-io (~> 0.16.1)
30
- cleanroom (~> 1.0)
31
- faraday (~> 0.9.0)
32
- minitar (~> 0.5.4)
33
- octokit (~> 3.0)
34
- retryable (~> 1.3.3)
35
- ridley (~> 4.0)
36
- solve (~> 1.1)
37
- thor (~> 0.19)
38
- berkshelf-api-client (1.2.0)
39
- faraday (~> 0.9.0)
40
- buff-config (1.0.1)
41
- buff-extensions (~> 1.0)
42
- varia_model (~> 0.4)
43
- buff-extensions (1.0.0)
44
- buff-ignore (1.1.1)
45
- buff-ruby_engine (0.1.0)
46
- buff-shell_out (0.2.0)
47
- buff-ruby_engine (~> 0.1.0)
48
- cabin (0.6.1)
49
- celluloid (0.16.0)
50
- timers (~> 4.0.0)
51
- celluloid-io (0.16.1)
52
- celluloid (>= 0.16.0)
53
- nio4r (>= 1.0.0)
54
- chef (11.16.4)
55
- chef-zero (~> 2.1, >= 2.1.4)
56
- diff-lcs (~> 1.2, >= 1.2.4)
57
- erubis (~> 2.7)
58
- ffi-yajl (~> 1.0)
59
- highline (~> 1.6, >= 1.6.9)
60
- mime-types (~> 1.16)
61
- mixlib-authentication (~> 1.3)
62
- mixlib-cli (~> 1.4)
63
- mixlib-config (~> 2.0)
64
- mixlib-log (~> 1.3)
65
- mixlib-shellout (~> 1.4)
66
- net-ssh (~> 2.6)
67
- net-ssh-multi (~> 1.1)
68
- ohai (~> 7.4)
69
- plist (~> 3.1.0)
70
- pry (~> 0.9)
71
- rest-client (>= 1.0.4, <= 1.6.7)
72
- chef-zero (2.2.1)
73
- ffi-yajl (~> 1.1)
74
- hashie (~> 2.0)
75
- mixlib-log (~> 1.3)
76
- rack
77
- childprocess (0.5.5)
78
- ffi (~> 1.0, >= 1.0.11)
79
- clamp (0.6.3)
80
- cleanroom (1.0.0)
81
- coderay (1.1.0)
82
- daemons (1.1.9)
83
- daybreak (0.3.0)
84
- dep-selector-libgecode (1.0.2)
85
- dep_selector (1.0.3)
86
- dep-selector-libgecode (~> 1.0)
87
- ffi (~> 1.9)
88
- diff-lcs (1.2.5)
89
- erubis (2.7.0)
90
- eventmachine (1.0.3)
91
- faraday (0.9.0)
92
- multipart-post (>= 1.2, < 3)
93
- ffi (1.9.6)
94
- ffi-yajl (1.3.1)
95
- ffi (~> 1.5)
96
- libyajl2 (~> 1.2)
97
- fpm (1.3.2)
98
- arr-pm (~> 0.0.9)
99
- backports (>= 2.6.2)
100
- cabin (>= 0.6.0)
101
- childprocess
102
- clamp (~> 0.6)
103
- ffi
104
- json (>= 1.7.7)
105
- git (1.2.8)
106
- hashie (2.1.2)
107
- highline (1.6.21)
108
- hipchat (1.4.0)
109
- httparty
110
- hitimes (1.2.2)
111
- httparty (0.13.3)
112
- json (~> 1.8)
113
- multi_xml (>= 0.5.2)
114
- ipaddress (0.8.0)
115
- json (1.8.1)
116
- libyajl2 (1.2.0)
117
- method_source (0.8.2)
118
- mime-types (1.25.1)
119
- minitar (0.5.4)
120
- minitest (5.4.3)
121
- mixlib-authentication (1.3.0)
122
- mixlib-log
123
- mixlib-cli (1.5.0)
124
- mixlib-config (2.1.0)
125
- mixlib-log (1.6.0)
126
- mixlib-shellout (1.6.1)
127
- multi_xml (0.5.5)
128
- multipart-post (2.0.0)
129
- net-http-persistent (2.9.4)
130
- net-ssh (2.9.1)
131
- net-ssh-gateway (1.2.0)
132
- net-ssh (>= 2.6.5)
133
- net-ssh-multi (1.2.0)
134
- net-ssh (>= 2.6.5)
135
- net-ssh-gateway (>= 1.2.0)
136
- nio4r (1.0.1)
137
- octokit (3.7.0)
138
- sawyer (~> 0.6.0, >= 0.5.3)
139
- ohai (7.4.0)
140
- ffi (~> 1.9)
141
- ffi-yajl (~> 1.0)
142
- ipaddress
143
- mime-types (~> 1.16)
144
- mixlib-cli
145
- mixlib-config (~> 2.0)
146
- mixlib-log
147
- mixlib-shellout (~> 1.2)
148
- systemu (~> 2.6.4)
149
- wmi-lite (~> 1.0)
150
- plist (3.1.0)
151
- pry (0.10.1)
152
- coderay (~> 1.1.0)
153
- method_source (~> 0.8.1)
154
- slop (~> 3.4)
155
- rack (1.5.2)
156
- rack-protection (1.5.3)
157
- rack
158
- rake (10.4.2)
159
- rest-client (1.6.7)
160
- mime-types (>= 1.16)
161
- retryable (1.3.6)
162
- ridley (4.1.0)
163
- addressable
164
- buff-config (~> 1.0)
165
- buff-extensions (~> 1.0)
166
- buff-ignore (~> 1.1)
167
- buff-shell_out (~> 0.1)
168
- celluloid (~> 0.16.0)
169
- celluloid-io (~> 0.16.1)
170
- erubis
171
- faraday (~> 0.9.0)
172
- hashie (>= 2.0.2, < 3.0.0)
173
- json (>= 1.7.7)
174
- mixlib-authentication (>= 1.3.0)
175
- net-http-persistent (>= 2.8)
176
- retryable
177
- semverse (~> 1.1)
178
- varia_model (~> 0.4)
179
- rubygems-tasks (0.2.4)
180
- sawyer (0.6.0)
181
- addressable (~> 2.3.5)
182
- faraday (~> 0.8, < 0.10)
183
- semverse (1.2.1)
184
- sinatra (1.4.5)
185
- rack (~> 1.4)
186
- rack-protection (~> 1.4)
187
- tilt (~> 1.3, >= 1.3.4)
188
- slop (3.6.0)
189
- solve (1.2.1)
190
- dep_selector (~> 1.0)
191
- semverse (~> 1.1)
192
- systemu (2.6.4)
193
- thin (1.6.3)
194
- daemons (~> 1.0, >= 1.0.9)
195
- eventmachine (~> 1.0)
196
- rack (~> 1.0)
197
- thor (0.19.1)
198
- tilt (1.4.1)
199
- timers (4.0.1)
200
- hitimes
201
- varia_model (0.4.0)
202
- buff-extensions (~> 1.0)
203
- hashie (>= 2.0.2, < 3.0.0)
204
- version (1.0.0)
205
- wmi-lite (1.0.0)
206
- yard (0.8.7.6)
207
-
208
- PLATFORMS
209
- ruby
210
-
211
- DEPENDENCIES
212
- fpm
213
- kitchen_hooks!
214
- minitest
215
- pry
216
- rake
217
- rubygems-tasks
218
- thin
219
- version
220
- yard
@@ -1,11 +0,0 @@
1
- <?xml version="1.0" encoding="utf-8"?>
2
- <!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
3
- <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
4
- <svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
5
- width="24px" height="24px" viewBox="0 0 24 24" style="enable-background:new 0 0 24 24;" xml:space="preserve">
6
- <style type="text/css">
7
- .st0{fill:#FFFFFF;}
8
- </style>
9
- <path class="st0" d="M12,1C7.6,1,4,4.6,4,9C4,16,12,23,12,23S20,16,20,9C20,4.6,16.4,1,12,1z M12,11.9c-1.6,0-3-1.3-3-3s1.3-3,3-3
10
- s3,1.3,3,3S13.6,11.9,12,11.9z"/>
11
- </svg>