alphasights-integrity 0.1.9.3

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.
Files changed (93) hide show
  1. data/.gitignore +13 -0
  2. data/CHANGES +48 -0
  3. data/README.md +82 -0
  4. data/Rakefile +58 -0
  5. data/bin/integrity +4 -0
  6. data/config/config.sample.ru +21 -0
  7. data/config/config.sample.yml +41 -0
  8. data/config/heroku/.gems +1 -0
  9. data/config/heroku/Rakefile +6 -0
  10. data/config/heroku/config.ru +7 -0
  11. data/config/heroku/integrity-config.rb +14 -0
  12. data/config/thin.sample.yml +13 -0
  13. data/integrity.gemspec +137 -0
  14. data/lib/integrity.rb +77 -0
  15. data/lib/integrity/app.rb +138 -0
  16. data/lib/integrity/author.rb +39 -0
  17. data/lib/integrity/build.rb +52 -0
  18. data/lib/integrity/commit.rb +61 -0
  19. data/lib/integrity/core_ext/object.rb +6 -0
  20. data/lib/integrity/helpers.rb +16 -0
  21. data/lib/integrity/helpers/authorization.rb +33 -0
  22. data/lib/integrity/helpers/breadcrumbs.rb +20 -0
  23. data/lib/integrity/helpers/gravatar.rb +16 -0
  24. data/lib/integrity/helpers/pretty_output.rb +45 -0
  25. data/lib/integrity/helpers/rendering.rb +49 -0
  26. data/lib/integrity/helpers/resources.rb +19 -0
  27. data/lib/integrity/helpers/urls.rb +59 -0
  28. data/lib/integrity/installer.rb +138 -0
  29. data/lib/integrity/migrations.rb +153 -0
  30. data/lib/integrity/notifier.rb +44 -0
  31. data/lib/integrity/notifier/base.rb +74 -0
  32. data/lib/integrity/notifier/test.rb +52 -0
  33. data/lib/integrity/notifier/test/fixtures.rb +108 -0
  34. data/lib/integrity/notifier/test/hpricot_matcher.rb +38 -0
  35. data/lib/integrity/project.rb +94 -0
  36. data/lib/integrity/project/notifiers.rb +31 -0
  37. data/lib/integrity/project/push.rb +43 -0
  38. data/lib/integrity/project_builder.rb +56 -0
  39. data/lib/integrity/scm.rb +19 -0
  40. data/lib/integrity/scm/git.rb +84 -0
  41. data/lib/integrity/scm/git/uri.rb +57 -0
  42. data/public/buttons.css +82 -0
  43. data/public/reset.css +7 -0
  44. data/public/spinner.gif +0 -0
  45. data/test/acceptance/api_test.rb +97 -0
  46. data/test/acceptance/browse_project_builds_test.rb +65 -0
  47. data/test/acceptance/browse_project_test.rb +99 -0
  48. data/test/acceptance/build_notifications_test.rb +114 -0
  49. data/test/acceptance/create_project_test.rb +97 -0
  50. data/test/acceptance/delete_project_test.rb +53 -0
  51. data/test/acceptance/edit_project_test.rb +117 -0
  52. data/test/acceptance/error_page_test.rb +21 -0
  53. data/test/acceptance/installer_test.rb +81 -0
  54. data/test/acceptance/manual_build_project_test.rb +82 -0
  55. data/test/acceptance/not_found_page_test.rb +29 -0
  56. data/test/acceptance/project_syndication_test.rb +30 -0
  57. data/test/acceptance/stylesheet_test.rb +26 -0
  58. data/test/acceptance/unauthorized_page_test.rb +20 -0
  59. data/test/helpers.rb +75 -0
  60. data/test/helpers/acceptance.rb +82 -0
  61. data/test/helpers/acceptance/email_notifier.rb +52 -0
  62. data/test/helpers/acceptance/git_helper.rb +99 -0
  63. data/test/helpers/acceptance/notifier_helper.rb +47 -0
  64. data/test/helpers/acceptance/textfile_notifier.rb +26 -0
  65. data/test/helpers/expectations.rb +4 -0
  66. data/test/helpers/expectations/be_a.rb +23 -0
  67. data/test/helpers/expectations/change.rb +90 -0
  68. data/test/helpers/expectations/have.rb +105 -0
  69. data/test/helpers/expectations/predicates.rb +37 -0
  70. data/test/helpers/initial_migration_fixture.sql +44 -0
  71. data/test/unit/build_test.rb +72 -0
  72. data/test/unit/commit_test.rb +66 -0
  73. data/test/unit/helpers_test.rb +103 -0
  74. data/test/unit/integrity_test.rb +35 -0
  75. data/test/unit/migrations_test.rb +57 -0
  76. data/test/unit/notifier/base_test.rb +43 -0
  77. data/test/unit/notifier_test.rb +96 -0
  78. data/test/unit/project_builder_test.rb +118 -0
  79. data/test/unit/project_test.rb +344 -0
  80. data/test/unit/scm_test.rb +54 -0
  81. data/views/_commit_info.haml +30 -0
  82. data/views/build.haml +2 -0
  83. data/views/error.haml +37 -0
  84. data/views/home.haml +22 -0
  85. data/views/integrity.sass +424 -0
  86. data/views/layout.haml +29 -0
  87. data/views/new.haml +50 -0
  88. data/views/not_found.haml +31 -0
  89. data/views/notifier.haml +7 -0
  90. data/views/project.builder +21 -0
  91. data/views/project.haml +31 -0
  92. data/views/unauthorized.haml +38 -0
  93. metadata +324 -0
@@ -0,0 +1,54 @@
1
+ require File.dirname(__FILE__) + "/../helpers"
2
+
3
+ class SCMTest < Test::Unit::TestCase
4
+ def scm(uri)
5
+ SCM.new(Addressable::URI.parse(uri), "master", "foo")
6
+ end
7
+
8
+ it "recognizes git URIs" do
9
+ scm("git://example.org/repo").should be_an(SCM::Git)
10
+ scm("git@example.org/repo.git").should be_an(SCM::Git)
11
+ scm("git://example.org/repo.git").should be_an(SCM::Git)
12
+ end
13
+
14
+ it "raises SCMUnknownError if it can't figure the SCM from the URI" do
15
+ lambda { scm("scm://example.org") }.should raise_error(SCM::SCMUnknownError)
16
+ end
17
+
18
+ it "doesn't need the working tree path for all operations, so it's not required on the constructor" do
19
+ lambda {
20
+ SCM.new(Addressable::URI.parse("git://github.com/foca/integrity.git"), "master")
21
+ }.should_not raise_error
22
+ end
23
+
24
+ describe "SCM::Git::URI" do
25
+ uris = [
26
+ "rsync://host.xz/path/to/repo.git/",
27
+ "rsync://host.xz/path/to/repo.git",
28
+ "rsync://host.xz/path/to/repo.gi",
29
+ "http://host.xz/path/to/repo.git/",
30
+ "https://host.xz/path/to/repo.git/",
31
+ "git://host.xz/path/to/repo.git/",
32
+ "git://host.xz/~user/path/to/repo.git/",
33
+ "ssh://[user@]host.xz[:port]/path/to/repo.git/",
34
+ "ssh://[user@]host.xz/path/to/repo.git/",
35
+ "ssh://[user@]host.xz/~user/path/to/repo.git/",
36
+ "ssh://[user@]host.xz/~/path/to/repo.git",
37
+ "host.xz:/path/to/repo.git/",
38
+ "host.xz:~user/path/to/repo.git/",
39
+ "host.xz:path/to/repo.git",
40
+ "user@host.xz:/path/to/repo.git/",
41
+ "user@host.xz:~user/path/to/repo.git/",
42
+ "user@host.xz:path/to/repo.git",
43
+ "user@host.xz:path/to/repo",
44
+ "user@host.xz:path/to/repo.a_git"
45
+ ]
46
+
47
+ uris.each do |uri|
48
+ it "parses the uri #{uri}" do
49
+ git_url = SCM::Git::URI.new(uri)
50
+ git_url.working_tree_path.should == "path-to-repo"
51
+ end
52
+ end
53
+ end
54
+ end
@@ -0,0 +1,30 @@
1
+ %h1&= commit.human_readable_status
2
+
3
+ - if commit.failed?
4
+ %form{ :action => commit_path(commit, :builds), :method => :post }
5
+ %p.submit
6
+ %button{ :type => :submit, :title => "Rebuild this commit" }<
7
+ Rebuild
8
+
9
+ %blockquote
10
+ %img.floating_gravatar{ gravatar_attrs(commit.author) }
11
+ %p&= commit.message
12
+ %p.meta<
13
+ %span.who<
14
+ %strong&= commit.author.name
15
+ %span.when{ :title => commit.committed_at }<
16
+ &= pretty_date commit.committed_at
17
+ %br
18
+ %span.what<
19
+ changeset:
20
+ - if commit.url
21
+ %a{ :href => commit.url, :title => "View #{commit.short_identifier} changeset" }<
22
+ &= commit.url
23
+ - else
24
+ %span{ :title => commit.identifier }<
25
+ &= commit.short_identifier
26
+
27
+ %h2 Build Output:
28
+ %pre.output
29
+ :preserve
30
+ #{bash_color_codes h(commit.output)}
data/views/build.haml ADDED
@@ -0,0 +1,2 @@
1
+ #build{ :class => @commit.status }
2
+ = partial(:commit_info, :commit => @commit)
data/views/error.haml ADDED
@@ -0,0 +1,37 @@
1
+ .error
2
+ %h1
3
+ Whatever you do, DON'T PANIC!
4
+
5
+ %dl
6
+ %dt This is what happened:
7
+ %dd
8
+ %strong&= @error.message
9
+ %pre.backtrace= @error.backtrace.join("\n")
10
+ %dd
11
+ %strong Query parameters:
12
+ %pre.query_params= params.inspect
13
+
14
+ %dt What can I do?
15
+ %dd
16
+ - if @project
17
+ Is your
18
+ %a{ :href => project_url(@project, :edit) } config
19
+ ok?
20
+ Need
21
+ %a{ :href => "http://integrityapp.com/configure" } help?
22
+ Remember to restart Integrity.
23
+ If you think everything is fine,
24
+ then drop by our irc channel:
25
+ %a{ :href => "irc://irc.freenode.org:6667/integrity" } #integrity
26
+ on freenode, and we'll try to help.
27
+
28
+ %dt
29
+ What the hell is
30
+ = succeed "?" do
31
+ %strong Integrity
32
+ %dd
33
+ Integrity is your friendly
34
+ %a{ :href => "http://en.wikipedia.org/wiki/Continuous_integration" } Continuous Integration
35
+ server. If you want to know more about us, check our website at
36
+ = succeed "." do
37
+ %a{ :href => "http://integrityapp.com" } integrityapp.com
data/views/home.haml ADDED
@@ -0,0 +1,22 @@
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 => root_path("/new") } create your first project
8
+ - else
9
+ %ul#projects
10
+ - @projects.each do |project|
11
+ %li{ :class => cycle("even", "odd") + ' ' + project.status.to_s }
12
+ %a{ :href => project_path(project) }&= project.name
13
+ .meta
14
+ %img.floating_gravatar{ gravatar_attrs(project.last_commit.author, 20) }
15
+ - if project.building?
16
+ Building!
17
+ - elsif project.last_commit.nil?
18
+ Never built yet
19
+ - else
20
+ = project.human_readable_status
21
+ %p#new
22
+ %a{ :href => root_path("/new") } Add a new project
@@ -0,0 +1,424 @@
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
+ input.text
112
+ :height 1.4em
113
+ label
114
+ :float left
115
+ :display block
116
+ :margin-top .5em
117
+ :width 8em
118
+ :margin-right .75em
119
+ .with_errors
120
+ label
121
+ :background red
122
+ :color white
123
+ :position relative
124
+ :top -.7em
125
+ &.required
126
+ label
127
+ :position static
128
+ :margin-right .25em
129
+ :padding 0 .2em
130
+ input, textarea
131
+ :border 2px solid #f22
132
+ :background #fee
133
+ :color = !text_color - #111
134
+ .required
135
+ label
136
+ :float none
137
+ :display block
138
+ :width auto
139
+ :position relative
140
+ :font-weight bold
141
+ :margin-top 1em
142
+ :text-indent -.65em
143
+ &:before
144
+ :content "* "
145
+ :color = !link_color
146
+ input.text
147
+ :width 25.6em
148
+ :font-size 24px
149
+ :font-weight bold
150
+ .normal
151
+ :margin-top 2em
152
+ h2.notifier label
153
+ :float none
154
+ :width auto
155
+ :margin-right 0
156
+ .warning
157
+ :font-size .5em
158
+ :font-weight normal
159
+ :color = !light_color
160
+ fieldset
161
+ :padding-bottom 1em
162
+ :margin-left 1.35em
163
+ :border-bottom = 1px "solid" !rule_color
164
+ :margin-bottom 1em
165
+ h3
166
+ :margin-top 1em
167
+ :margin-bottom 0
168
+ p.normal
169
+ :margin-top 1em
170
+ p label
171
+ :width 6.7em
172
+ p.submit
173
+ :margin-top 2em
174
+ &:after
175
+ :display block
176
+ :clear both
177
+ :float none
178
+ :content "."
179
+ :text-indent -9999em
180
+ :text-align left
181
+ &.destroy, &.manual-build
182
+ button
183
+ :float none
184
+ :display inline
185
+ &.manual-build
186
+ button
187
+ :margin-right 0
188
+
189
+ #build form, #last_build form
190
+ :font-size .75em
191
+ p.submit
192
+ :margin 0
193
+ :padding 0
194
+ :position absolute
195
+ :right .5em
196
+ :top 1.25em
197
+
198
+ .blank_slate, .error
199
+ p
200
+ :position relative
201
+ :top .3em
202
+ h1
203
+ :border-width 0
204
+ :margin 0
205
+ :padding 0
206
+ button
207
+ :float none
208
+ :border 0 none
209
+ :background transparent
210
+ :display inline
211
+ :color = !link_color
212
+ :padding 0.25em 0
213
+ :margin 0
214
+ &:hover
215
+ :background = !link_color
216
+ :color = !link_bg
217
+
218
+ .error
219
+ dt
220
+ :margin
221
+ :top 1.4em
222
+ :bottom .3em
223
+ :font
224
+ :size 1.75em
225
+ :family = !nice_fonts
226
+ dd
227
+ :line-height 1.4
228
+
229
+ .backtrace
230
+ :margin 1em 0
231
+ :overflow scroll
232
+ :height 30em
233
+ :border = 1px "solid" !rule_color
234
+ :line-height 1.6
235
+
236
+ #projects
237
+ :margin 1em 0 2em
238
+ :border-top = 1px "solid" !rule_color
239
+ li
240
+ :position relative
241
+ :border-bottom = 1px "solid" !rule_color
242
+ &.odd
243
+ :background = !content_bg - #080808
244
+ &.building
245
+ :background transparent url(/spinner.gif) no-repeat scroll right
246
+ a
247
+ :font-size 2em
248
+ :padding .25em
249
+ :line-height 1.2
250
+ :font-weight bold
251
+ :display block
252
+ &.success
253
+ :color = !success_color
254
+ &.failed
255
+ :color = !failed_color
256
+ .meta
257
+ :position absolute
258
+ :right .6em
259
+ :top 1em
260
+ :line-height 24px
261
+ :font-size 0.8em
262
+ :color = !light_color
263
+ :text-align right
264
+ &.building .meta
265
+ :right 1.6em
266
+ &.success .meta
267
+ :color = !success_color
268
+ &.failed .meta
269
+ :color = !failed_color
270
+
271
+
272
+ #previous_builds
273
+ li
274
+ a
275
+ :display block
276
+ :padding .25em
277
+ :margin-bottom .25em
278
+ :border
279
+ :width 1px
280
+ :style solid
281
+ strong
282
+ :font-size 1.3em
283
+ .attribution
284
+ :font-size .9em
285
+
286
+ #projects, #previous_builds
287
+ li
288
+ &.success a
289
+ :background-color = !success_bg
290
+ :border-color = !success_bg - #222
291
+ :color = !success_color
292
+ .attribution
293
+ :color = !success_bg - #444
294
+ &:hover
295
+ :background-color = !success_bg + #222
296
+ &.failed a
297
+ :background-color = !failed_bg
298
+ :border-color = !failed_bg - #222
299
+ :color = !failed_color
300
+ .attribution
301
+ :color = !failed_bg - #444
302
+ &:hover
303
+ :background-color = !failed_bg + #222
304
+
305
+
306
+ #build, #last_build
307
+ :position relative
308
+ h1, blockquote
309
+ :border
310
+ :width 0 1px
311
+ :style solid
312
+ h1
313
+ :border-top-width 1px
314
+ blockquote
315
+ :bottom-bottom-width 1px
316
+ :line-height 1.4
317
+ p
318
+ :padding-left 60px
319
+
320
+ &.success
321
+ h1, blockquote
322
+ :background-color = !success_bg
323
+ :border-color = (!success_bg - #222) (!success_bg + #111) (!success_bg + #111) (!success_bg - #222)
324
+ h1
325
+ :color = !success_color
326
+ .meta
327
+ :color = !success_bg - #444
328
+ span.what a
329
+ :color = !success_bg - #555
330
+ &:hover
331
+ :background-color = !success_bg - #555
332
+ :color #fff
333
+
334
+ &.failed
335
+ h1, blockquote
336
+ :background-color = !failed_bg
337
+ :border-color = (!failed_bg - #222) (!failed_bg + #111) (!failed_bg + #111) (!failed_bg - #222)
338
+ h1
339
+ :color = !failed_color
340
+ .meta
341
+ :color = !failed_bg - #444
342
+ span.what a
343
+ :color = !failed_bg - #555
344
+ &:hover
345
+ :background-color = !failed_bg - #555
346
+ :color #fff
347
+
348
+ h1
349
+ :margin-top .5em
350
+ :margin-bottom 0
351
+ :padding .25em
352
+ :color = !success_color
353
+
354
+ blockquote
355
+ :padding .75em
356
+ :margin-bottom 2em
357
+ .meta
358
+ :margin-top 1em
359
+ :display block
360
+ :font-size .9em
361
+
362
+ pre.output
363
+ :background #111
364
+ :color #fff
365
+ :padding .5em
366
+ :overflow auto
367
+ :max-height 50em
368
+ :font-size .825em
369
+
370
+ .color30
371
+ :color #333
372
+ .color31
373
+ :color #e33
374
+ .color32
375
+ :color #3e3
376
+ .color33
377
+ :color #ee3
378
+ .color34
379
+ :color #33e
380
+ .color35
381
+ :color #e3e
382
+ .color36
383
+ :color #3ee
384
+ .color37
385
+ :color #fff
386
+
387
+ #push_path
388
+ :display block
389
+ :margin
390
+ :top 1em
391
+ :left 2em
392
+
393
+ a
394
+ &.success
395
+ :color = !success_bg
396
+ &:hover
397
+ :background-color = !success_bg
398
+ :color white
399
+ &.failed
400
+ :color = !failed_bg
401
+ &:hover
402
+ :background-color = !failed_bg
403
+ :color white
404
+
405
+ img.floating_gravatar
406
+ :float left
407
+ :background-color #fff
408
+ :border 1px solid #ccc
409
+ :padding 2px
410
+
411
+ ul#projects li img.floating_gravatar,
412
+ ul#previous_builds li img.floating_gravatar
413
+ :margin-right 5px
414
+ :padding 1px
415
+
416
+ #footer
417
+ :padding 1.5em 2.5em
418
+ :border-top 1px solid #ccc
419
+ :font-size .8em
420
+ :width 50em !important
421
+ :color #666
422
+ :text-align right
423
+ strong
424
+ :font-weight bold