gforces-integrity 0.1.9.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (94) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGES +42 -0
  3. data/README.md +82 -0
  4. data/Rakefile +57 -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 +138 -0
  14. data/lib/integrity.rb +78 -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 +60 -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/forms.rb +29 -0
  24. data/lib/integrity/helpers/pretty_output.rb +45 -0
  25. data/lib/integrity/helpers/rendering.rb +25 -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 +151 -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 +59 -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 +100 -0
  36. data/lib/integrity/project/notifiers.rb +33 -0
  37. data/lib/integrity/project/push.rb +44 -0
  38. data/lib/integrity/project_builder.rb +56 -0
  39. data/lib/integrity/scm.rb +21 -0
  40. data/lib/integrity/scm/git.rb +89 -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 +95 -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 +18 -0
  53. data/test/acceptance/installer_test.rb +79 -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 +82 -0
  60. data/test/helpers/acceptance.rb +83 -0
  61. data/test/helpers/acceptance/email_notifier.rb +55 -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_test.rb +29 -0
  78. data/test/unit/notifier_test.rb +97 -0
  79. data/test/unit/project_builder_test.rb +118 -0
  80. data/test/unit/project_test.rb +363 -0
  81. data/test/unit/scm_test.rb +54 -0
  82. data/views/_commit_info.haml +24 -0
  83. data/views/build.haml +2 -0
  84. data/views/error.haml +37 -0
  85. data/views/home.haml +21 -0
  86. data/views/integrity.sass +400 -0
  87. data/views/layout.haml +29 -0
  88. data/views/new.haml +50 -0
  89. data/views/not_found.haml +31 -0
  90. data/views/notifier.haml +7 -0
  91. data/views/project.builder +21 -0
  92. data/views/project.haml +30 -0
  93. data/views/unauthorized.haml +38 -0
  94. metadata +325 -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,24 @@
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
+ %p&= commit.message
11
+ %p.meta<
12
+ %span.who<
13
+ &== by: #{commit.author.name}
14
+ |
15
+ %span.when{ :title => commit.committed_at }<
16
+ &= pretty_date commit.committed_at
17
+ |
18
+ %span.what<
19
+ &== commit: #{commit.identifier}
20
+
21
+ %h2 Build Output:
22
+ %pre.output
23
+ :preserve
24
+ #{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,21 @@
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
+ - if project.building?
15
+ Building!
16
+ - elsif project.last_commit.nil?
17
+ Never built yet
18
+ - else
19
+ = project.human_readable_status
20
+ %p#new
21
+ %a{ :href => root_path("/new") } Add a new project
@@ -0,0 +1,400 @@
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 1.5em
260
+ :font-size 0.8em
261
+ :color = !light_color
262
+ :text-align right
263
+ &.building .meta
264
+ :right 1.6em
265
+ &.success .meta
266
+ :color = !success_color
267
+ &.failed .meta
268
+ :color = !failed_color
269
+
270
+
271
+ #previous_builds
272
+ li
273
+ a
274
+ :display block
275
+ :padding .25em
276
+ :margin-bottom .25em
277
+ :border
278
+ :width 1px
279
+ :style solid
280
+ strong
281
+ :font-size 1.3em
282
+ .attribution
283
+ :font-size .9em
284
+
285
+ #projects, #previous_builds
286
+ li
287
+ &.success a
288
+ :background-color = !success_bg
289
+ :border-color = !success_bg - #222
290
+ :color = !success_color
291
+ .attribution
292
+ :color = !success_bg - #444
293
+ &:hover
294
+ :background-color = !success_bg + #222
295
+ &.failed a
296
+ :background-color = !failed_bg
297
+ :border-color = !failed_bg - #222
298
+ :color = !failed_color
299
+ .attribution
300
+ :color = !failed_bg - #444
301
+ &:hover
302
+ :background-color = !failed_bg + #222
303
+
304
+
305
+ #build, #last_build
306
+ :position relative
307
+ h1, blockquote
308
+ :border
309
+ :width 0 1px
310
+ :style solid
311
+ h1
312
+ :border-top-width 1px
313
+ blockquote
314
+ :bottom-bottom-width 1px
315
+ :line-height 1.4
316
+
317
+ &.success
318
+ h1, blockquote
319
+ :background-color = !success_bg
320
+ :border-color = (!success_bg - #222) (!success_bg + #111) (!success_bg + #111) (!success_bg - #222)
321
+ h1
322
+ :color = !success_color
323
+ .meta
324
+ :color = !success_bg - #444
325
+
326
+ &.failed
327
+ h1, blockquote
328
+ :background-color = !failed_bg
329
+ :border-color = (!failed_bg - #222) (!failed_bg + #111) (!failed_bg + #111) (!failed_bg - #222)
330
+ h1
331
+ :color = !failed_color
332
+ .meta
333
+ :color = !failed_bg - #444
334
+
335
+ h1
336
+ :margin-top .5em
337
+ :margin-bottom 0
338
+ :padding .25em
339
+ :color = !success_color
340
+
341
+ blockquote
342
+ :padding .75em
343
+ :margin-bottom 2em
344
+ .meta
345
+ :margin-top 1em
346
+ :display block
347
+ :font-size .9em
348
+
349
+ pre.output
350
+ :background #111
351
+ :color #fff
352
+ :padding .5em
353
+ :overflow auto
354
+ :max-height 50em
355
+ :font-size .825em
356
+
357
+ .color30
358
+ :color #333
359
+ .color31
360
+ :color #e33
361
+ .color32
362
+ :color #3e3
363
+ .color33
364
+ :color #ee3
365
+ .color34
366
+ :color #33e
367
+ .color35
368
+ :color #e3e
369
+ .color36
370
+ :color #3ee
371
+ .color37
372
+ :color #fff
373
+
374
+ #push_path
375
+ :display block
376
+ :margin
377
+ :top 1em
378
+ :left 2em
379
+
380
+ a
381
+ &.success
382
+ :color = !success_bg
383
+ &:hover
384
+ :background-color = !success_bg
385
+ :color white
386
+ &.failed
387
+ :color = !failed_bg
388
+ &:hover
389
+ :background-color = !failed_bg
390
+ :color white
391
+
392
+ #footer
393
+ :padding 1.5em 2.5em
394
+ :border-top 1px solid #ccc
395
+ :font-size .8em
396
+ :width 50em !important
397
+ :color #666
398
+ :text-align right
399
+ strong
400
+ :font-weight bold