foca-integrity 0.1.0
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/README.markdown +139 -0
- data/Rakefile +87 -0
- data/app.rb +247 -0
- data/bin/integrity +60 -0
- data/config/config.sample.ru +30 -0
- data/config/config.sample.yml +8 -0
- data/config/thin.sample.yml +14 -0
- data/integrity.gemspec +65 -0
- data/lib/integrity.rb +47 -0
- data/lib/integrity/build.rb +56 -0
- data/lib/integrity/builder.rb +42 -0
- data/lib/integrity/core_ext/object.rb +6 -0
- data/lib/integrity/core_ext/string.rb +5 -0
- data/lib/integrity/core_ext/time.rb +13 -0
- data/lib/integrity/notifier.rb +49 -0
- data/lib/integrity/notifier/base.rb +56 -0
- data/lib/integrity/project.rb +83 -0
- data/lib/integrity/scm.rb +22 -0
- data/lib/integrity/scm/git.rb +72 -0
- data/lib/integrity/scm/git/uri.rb +57 -0
- data/lib/integrity/version.rb +3 -0
- data/public/buttons.css +82 -0
- data/public/reset.css +7 -0
- data/public/spinner.gif +0 -0
- data/spec/form_field_matchers.rb +91 -0
- data/spec/spec_helper.rb +131 -0
- data/vendor/sinatra-hacks/lib/hacks.rb +49 -0
- data/views/build.haml +2 -0
- data/views/build_info.haml +22 -0
- data/views/home.haml +14 -0
- data/views/integrity.sass +361 -0
- data/views/layout.haml +25 -0
- data/views/new.haml +53 -0
- data/views/not_found.haml +31 -0
- data/views/notifier.haml +7 -0
- data/views/project.haml +32 -0
- data/views/unauthorized.haml +38 -0
- metadata +197 -0
@@ -0,0 +1,49 @@
|
|
1
|
+
module Sinatra
|
2
|
+
class EventContext
|
3
|
+
def params
|
4
|
+
@params ||= ParamsParser.new(@route_params.merge(@request.params)).to_hash
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
class ParamsParser
|
10
|
+
attr_reader :hash
|
11
|
+
|
12
|
+
def initialize(hash)
|
13
|
+
@hash = nested(hash)
|
14
|
+
end
|
15
|
+
|
16
|
+
alias :to_hash :hash
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def nested(hash)
|
21
|
+
hash.inject(indifferent_hash) do |par, (key,val)|
|
22
|
+
if key =~ /([^\[]+)\[([^\]]+)\](.*)/ # a[b] || a[b][c] ($1 == a, $2 == b, $3 == [c])
|
23
|
+
par[$1] ||= indifferent_hash
|
24
|
+
par[$1].merge_recursive nested("#{$2}#{$3}" => val)
|
25
|
+
else
|
26
|
+
par[key] = val
|
27
|
+
end
|
28
|
+
par
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
def indifferent_hash
|
33
|
+
Hash.new {|h,k| h[k.to_s] if Symbol === k}
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
class Hash
|
40
|
+
def merge_recursive(other)
|
41
|
+
update(other) do |key, old_value, new_value|
|
42
|
+
if Hash === old_value && Hash === new_value
|
43
|
+
old_value.merge_recursive(new_value)
|
44
|
+
else
|
45
|
+
new_value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
data/views/build.haml
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
%h1
|
2
|
+
Built
|
3
|
+
&= @build.short_commit_identifier
|
4
|
+
= @build.successful? ? "successfully" : "and failed"
|
5
|
+
%blockquote
|
6
|
+
%p&= @build.commit_message
|
7
|
+
%p.meta<
|
8
|
+
%span.who<
|
9
|
+
by:
|
10
|
+
&= @build.commit_author.name
|
11
|
+
|
|
12
|
+
%span.when{ :title => @build.commited_at.iso8601 }<
|
13
|
+
&= pretty_date @build.commited_at
|
14
|
+
|
|
15
|
+
%span.what<
|
16
|
+
commit:
|
17
|
+
&= @build.commit_identifier
|
18
|
+
|
19
|
+
%h2 Build Output:
|
20
|
+
%pre.output
|
21
|
+
:preserve
|
22
|
+
#{bash_color_codes h(@build.output)}
|
data/views/home.haml
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
- if @projects.empty?
|
2
|
+
.blank_slate
|
3
|
+
%p None yet, huh?
|
4
|
+
%h1
|
5
|
+
Why don't you
|
6
|
+
= succeed "?" do
|
7
|
+
%a{ :href => "/new" } create your first project
|
8
|
+
- else
|
9
|
+
%ul#projects
|
10
|
+
- @projects.each do |project|
|
11
|
+
%li{ :class => cycle("even", "odd") + (project.building? ? ' building' : '') }
|
12
|
+
%a{ :href => project_url(project) }&= project.name
|
13
|
+
%p#new
|
14
|
+
%a{ :href => "/new" } Add a new project
|
@@ -0,0 +1,361 @@
|
|
1
|
+
!default_fonts = "Helvetica Neue, Helvetica, Arial, sans-serif"
|
2
|
+
!nice_fonts = "Georgia, Times New Roman, serif"
|
3
|
+
!monospace_fonts = "Monaco, Deja Vu Sans Mono, Inconsolata, Consolas, monospace"
|
4
|
+
|
5
|
+
!page_bg = #e0e0e0
|
6
|
+
!content_bg = #eee
|
7
|
+
!header_bg = #fff
|
8
|
+
!text_color = #333
|
9
|
+
!light_color = #999
|
10
|
+
!title_color = #4e4e4e
|
11
|
+
!link_color = #ed1556
|
12
|
+
!link_bg = #fff
|
13
|
+
!rule_color = #c0c0c0
|
14
|
+
!watermark = #ccc
|
15
|
+
!quote_bg = #fff
|
16
|
+
!success_bg = #bbf8aa
|
17
|
+
!success_color = #337022
|
18
|
+
!failed_bg = #fba
|
19
|
+
!failed_color = #f10
|
20
|
+
|
21
|
+
html
|
22
|
+
:background-color = !page_bg
|
23
|
+
|
24
|
+
body
|
25
|
+
:font-size 100%
|
26
|
+
:font-family = !default_fonts
|
27
|
+
:color = !text_color
|
28
|
+
|
29
|
+
a
|
30
|
+
:color = !link_color
|
31
|
+
:text-decoration none
|
32
|
+
&:hover
|
33
|
+
:color = !link_bg
|
34
|
+
:background-color = !link_color
|
35
|
+
|
36
|
+
#header, #content, #footer
|
37
|
+
:width 40em
|
38
|
+
:margin 0 auto
|
39
|
+
:background = !content_bg
|
40
|
+
:padding 0 2em
|
41
|
+
:z-index 0
|
42
|
+
:position relative
|
43
|
+
:font-size 1em
|
44
|
+
|
45
|
+
#header
|
46
|
+
:background = !header_bg
|
47
|
+
h1
|
48
|
+
:font-weight bold
|
49
|
+
:font-size 1.5em
|
50
|
+
address.watermark
|
51
|
+
:position absolute
|
52
|
+
:font-weight bold
|
53
|
+
:right 3em
|
54
|
+
:top 0
|
55
|
+
:font-size .75em
|
56
|
+
:color = !watermark
|
57
|
+
a
|
58
|
+
:color = !watermark
|
59
|
+
:font-weight bold
|
60
|
+
:font-size 2em
|
61
|
+
&:hover
|
62
|
+
:background transparent
|
63
|
+
:color = !watermark - #222
|
64
|
+
|
65
|
+
#content
|
66
|
+
:padding-top 1em
|
67
|
+
:padding-bottom 2em
|
68
|
+
|
69
|
+
strong
|
70
|
+
:font-weight bold
|
71
|
+
em
|
72
|
+
:font-style italic
|
73
|
+
|
74
|
+
h1, h2, h3, h4, h5, h6
|
75
|
+
:color = !title_color
|
76
|
+
h1
|
77
|
+
:font-size 2em
|
78
|
+
:font-weight bold
|
79
|
+
:margin-bottom .75em
|
80
|
+
:padding .25em 0
|
81
|
+
:line-height 1.2
|
82
|
+
:border-bottom = 1px solid !rule_color
|
83
|
+
h2
|
84
|
+
:font-weight bold
|
85
|
+
:font-size 1.5em
|
86
|
+
:margin 1em 0 .2em
|
87
|
+
h3
|
88
|
+
:font-weight bold
|
89
|
+
:font-size 1.25em
|
90
|
+
:margin .25em 0
|
91
|
+
h4, h5, h6
|
92
|
+
:font-weight bold
|
93
|
+
:margin-top .5em
|
94
|
+
|
95
|
+
code, pre, textarea, input
|
96
|
+
:font-family = !monospace_fonts
|
97
|
+
pre
|
98
|
+
margin .5em :0
|
99
|
+
padding .5em
|
100
|
+
|
101
|
+
form
|
102
|
+
p
|
103
|
+
:margin-top 1em
|
104
|
+
:position relative
|
105
|
+
&.checkbox label
|
106
|
+
:margin-top 0 !important
|
107
|
+
input.text, textarea
|
108
|
+
:width 30em
|
109
|
+
:padding .2em .4em
|
110
|
+
:color = !title_color
|
111
|
+
:height 1.4em
|
112
|
+
label
|
113
|
+
:float left
|
114
|
+
:display block
|
115
|
+
:margin-top .5em
|
116
|
+
:width 8em
|
117
|
+
:margin-right .75em
|
118
|
+
.with_errors
|
119
|
+
label
|
120
|
+
:background red
|
121
|
+
:color white
|
122
|
+
:position relative
|
123
|
+
:top -.7em
|
124
|
+
&.required
|
125
|
+
label
|
126
|
+
:position static
|
127
|
+
:margin-right .25em
|
128
|
+
:padding 0 .2em
|
129
|
+
input, textarea
|
130
|
+
:border 2px solid #f22
|
131
|
+
:background #fee
|
132
|
+
:color = !text_color - #111
|
133
|
+
.required
|
134
|
+
label
|
135
|
+
:float none
|
136
|
+
:display block
|
137
|
+
:width auto
|
138
|
+
:position relative
|
139
|
+
:font-weight bold
|
140
|
+
:margin-top 1em
|
141
|
+
:text-indent -.65em
|
142
|
+
&:before
|
143
|
+
:content "* "
|
144
|
+
:color = !link_color
|
145
|
+
input.text
|
146
|
+
:width 25.6em
|
147
|
+
:font-size 24px
|
148
|
+
:font-weight bold
|
149
|
+
.normal
|
150
|
+
:margin-top 2em
|
151
|
+
h2.notifier label
|
152
|
+
:float none
|
153
|
+
:width auto
|
154
|
+
:margin-right 0
|
155
|
+
.warning
|
156
|
+
:font-size .5em
|
157
|
+
:font-weight normal
|
158
|
+
:color = !light_color
|
159
|
+
fieldset
|
160
|
+
:padding-bottom 1em
|
161
|
+
:margin-left 1.35em
|
162
|
+
:border-bottom = 1px solid !rule_color
|
163
|
+
:margin-bottom 1em
|
164
|
+
h3
|
165
|
+
:margin-top 1em
|
166
|
+
:margin-bottom 0
|
167
|
+
p.normal
|
168
|
+
:margin-top 1em
|
169
|
+
p label
|
170
|
+
:width 6.7em
|
171
|
+
p.submit
|
172
|
+
:margin-top 2em
|
173
|
+
&:after
|
174
|
+
:display block
|
175
|
+
:clear both
|
176
|
+
:float none
|
177
|
+
:content "."
|
178
|
+
:text-indent -9999em
|
179
|
+
:text-align left
|
180
|
+
&.destroy
|
181
|
+
:margin-top 0
|
182
|
+
button
|
183
|
+
:float none
|
184
|
+
:display inline
|
185
|
+
|
186
|
+
.blank_slate, .error
|
187
|
+
p
|
188
|
+
:position relative
|
189
|
+
:top .3em
|
190
|
+
h1
|
191
|
+
:border-width 0
|
192
|
+
:margin 0
|
193
|
+
:padding 0
|
194
|
+
button
|
195
|
+
:float none
|
196
|
+
:border 0 none
|
197
|
+
:background transparent
|
198
|
+
:display inline
|
199
|
+
:color = !link_color
|
200
|
+
:padding 0.25em 0
|
201
|
+
:margin 0
|
202
|
+
&:hover
|
203
|
+
:background = !link_color
|
204
|
+
:color = !link_bg
|
205
|
+
|
206
|
+
.error
|
207
|
+
dt
|
208
|
+
:margin
|
209
|
+
:top 1.4em
|
210
|
+
:bottom .3em
|
211
|
+
:font
|
212
|
+
:size 1.75em
|
213
|
+
:family = !nice_fonts
|
214
|
+
dd
|
215
|
+
:line-height 1.4
|
216
|
+
|
217
|
+
#projects
|
218
|
+
:margin 1em 0 2em
|
219
|
+
:border-top = 1px solid !rule_color
|
220
|
+
li
|
221
|
+
:border-bottom = 1px solid !rule_color
|
222
|
+
&.odd
|
223
|
+
:background = !content_bg - #080808
|
224
|
+
&.building
|
225
|
+
:background transparent url(/spinner.gif) no-repeat scroll right
|
226
|
+
a
|
227
|
+
:font-size 2em
|
228
|
+
:padding .25em
|
229
|
+
:line-height 1.2
|
230
|
+
:font-weight bold
|
231
|
+
:display block
|
232
|
+
&.success
|
233
|
+
:color = !success_color
|
234
|
+
&.failed
|
235
|
+
:color = !failed_color
|
236
|
+
|
237
|
+
#previous_builds
|
238
|
+
li
|
239
|
+
a
|
240
|
+
:display block
|
241
|
+
:padding .25em
|
242
|
+
:margin-bottom .25em
|
243
|
+
:border
|
244
|
+
:width 1px
|
245
|
+
:style solid
|
246
|
+
strong
|
247
|
+
:font-size 1.3em
|
248
|
+
.attribution
|
249
|
+
:font-size .9em
|
250
|
+
&.success a
|
251
|
+
:background-color = !success_bg
|
252
|
+
:border-color = !success_bg - #222
|
253
|
+
:color = !success_color
|
254
|
+
.attribution
|
255
|
+
:color = !success_bg - #444
|
256
|
+
&:hover
|
257
|
+
:background-color = !success_bg + #222
|
258
|
+
&.failed a
|
259
|
+
:background-color = !failed_bg
|
260
|
+
:border-color = !failed_bg - #222
|
261
|
+
:color = !failed_color
|
262
|
+
.attribution
|
263
|
+
:color = !failed_bg - #444
|
264
|
+
&:hover
|
265
|
+
:background-color = !failed_bg + #222
|
266
|
+
|
267
|
+
#build, #last_build
|
268
|
+
h1, blockquote
|
269
|
+
:border
|
270
|
+
:width 0 1px
|
271
|
+
:style solid
|
272
|
+
h1
|
273
|
+
:border-top-width 1px
|
274
|
+
blockquote
|
275
|
+
:bottom-bottom-width 1px
|
276
|
+
:line-height 1.4
|
277
|
+
|
278
|
+
&.success
|
279
|
+
h1, blockquote
|
280
|
+
:background-color = !success_bg
|
281
|
+
:border-color = (!success_bg - #222) (!success_bg + #111) (!success_bg + #111) (!success_bg - #222)
|
282
|
+
h1
|
283
|
+
:color = !success_color
|
284
|
+
.meta
|
285
|
+
:color = !success_bg - #444
|
286
|
+
|
287
|
+
&.failed
|
288
|
+
h1, blockquote
|
289
|
+
:background-color = !failed_bg
|
290
|
+
:border-color = (!failed_bg - #222) (!failed_bg + #111) (!failed_bg + #111) (!failed_bg - #222)
|
291
|
+
h1
|
292
|
+
:color = !failed_color
|
293
|
+
.meta
|
294
|
+
:color = !failed_bg - #444
|
295
|
+
|
296
|
+
h1
|
297
|
+
:margin-top .5em
|
298
|
+
:margin-bottom 0
|
299
|
+
:padding .25em
|
300
|
+
:color = !success_color
|
301
|
+
|
302
|
+
blockquote
|
303
|
+
:padding .75em
|
304
|
+
:margin-bottom 2em
|
305
|
+
.meta
|
306
|
+
:margin-top 1em
|
307
|
+
:display block
|
308
|
+
:font-size .9em
|
309
|
+
|
310
|
+
pre.output
|
311
|
+
:background #111
|
312
|
+
:color #fff
|
313
|
+
:padding .5em
|
314
|
+
:overflow auto
|
315
|
+
:max-height 50em
|
316
|
+
:font-size .825em
|
317
|
+
|
318
|
+
.color30
|
319
|
+
:color #333
|
320
|
+
.color31
|
321
|
+
:color #e33
|
322
|
+
.color32
|
323
|
+
:color #3e3
|
324
|
+
.color33
|
325
|
+
:color #ee3
|
326
|
+
.color34
|
327
|
+
:color #33e
|
328
|
+
.color35
|
329
|
+
:color #e3e
|
330
|
+
.color36
|
331
|
+
:color #3ee
|
332
|
+
.color37
|
333
|
+
:color #fff
|
334
|
+
|
335
|
+
#push_url
|
336
|
+
:display block
|
337
|
+
:margin
|
338
|
+
:top 1em
|
339
|
+
:left 2em
|
340
|
+
|
341
|
+
a
|
342
|
+
&.success
|
343
|
+
:color = !success_bg
|
344
|
+
&:hover
|
345
|
+
:background-color = !success_bg
|
346
|
+
:color white
|
347
|
+
&.failed
|
348
|
+
:color = !failed_bg
|
349
|
+
&:hover
|
350
|
+
:background-color = !failed_bg
|
351
|
+
:color white
|
352
|
+
|
353
|
+
#footer
|
354
|
+
:padding 1.5em 2.5em
|
355
|
+
:border-top 1px solid #ccc
|
356
|
+
:font-size .8em
|
357
|
+
:width 50em !important
|
358
|
+
:color #666
|
359
|
+
:text-align right
|
360
|
+
strong
|
361
|
+
:font-weight bold
|