imbriaco-integrity 0.1.9.2

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 (96) hide show
  1. data/.gitignore +12 -0
  2. data/CHANGES +36 -0
  3. data/README.markdown +79 -0
  4. data/Rakefile +79 -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 +140 -0
  14. data/lib/integrity/app.rb +138 -0
  15. data/lib/integrity/author.rb +39 -0
  16. data/lib/integrity/build.rb +91 -0
  17. data/lib/integrity/commit.rb +63 -0
  18. data/lib/integrity/core_ext/object.rb +6 -0
  19. data/lib/integrity/helpers/authorization.rb +33 -0
  20. data/lib/integrity/helpers/breadcrumbs.rb +20 -0
  21. data/lib/integrity/helpers/forms.rb +29 -0
  22. data/lib/integrity/helpers/pretty_output.rb +45 -0
  23. data/lib/integrity/helpers/rendering.rb +25 -0
  24. data/lib/integrity/helpers/resources.rb +19 -0
  25. data/lib/integrity/helpers/urls.rb +59 -0
  26. data/lib/integrity/helpers.rb +16 -0
  27. data/lib/integrity/installer.rb +136 -0
  28. data/lib/integrity/migrations.rb +151 -0
  29. data/lib/integrity/notifier/base.rb +74 -0
  30. data/lib/integrity/notifier/test/fixtures.rb +108 -0
  31. data/lib/integrity/notifier/test/hpricot_matcher.rb +38 -0
  32. data/lib/integrity/notifier/test.rb +59 -0
  33. data/lib/integrity/notifier.rb +34 -0
  34. data/lib/integrity/project/deprecated.rb +17 -0
  35. data/lib/integrity/project/notifiers.rb +33 -0
  36. data/lib/integrity/project/push.rb +44 -0
  37. data/lib/integrity/project.rb +102 -0
  38. data/lib/integrity/project_builder.rb +56 -0
  39. data/lib/integrity/scm/git/uri.rb +57 -0
  40. data/lib/integrity/scm/git.rb +84 -0
  41. data/lib/integrity/scm.rb +19 -0
  42. data/lib/integrity.rb +101 -0
  43. data/public/buttons.css +82 -0
  44. data/public/reset.css +7 -0
  45. data/public/spinner.gif +0 -0
  46. data/test/acceptance/api_test.rb +97 -0
  47. data/test/acceptance/browse_project_builds_test.rb +65 -0
  48. data/test/acceptance/browse_project_test.rb +99 -0
  49. data/test/acceptance/build_notifications_test.rb +95 -0
  50. data/test/acceptance/create_project_test.rb +97 -0
  51. data/test/acceptance/delete_project_test.rb +53 -0
  52. data/test/acceptance/edit_project_test.rb +117 -0
  53. data/test/acceptance/error_page_test.rb +18 -0
  54. data/test/acceptance/installer_test.rb +79 -0
  55. data/test/acceptance/manual_build_project_test.rb +82 -0
  56. data/test/acceptance/not_found_page_test.rb +29 -0
  57. data/test/acceptance/project_syndication_test.rb +30 -0
  58. data/test/acceptance/stylesheet_test.rb +26 -0
  59. data/test/acceptance/unauthorized_page_test.rb +20 -0
  60. data/test/helpers/acceptance/email_notifier.rb +55 -0
  61. data/test/helpers/acceptance/git_helper.rb +99 -0
  62. data/test/helpers/acceptance/notifier_helper.rb +47 -0
  63. data/test/helpers/acceptance/textfile_notifier.rb +26 -0
  64. data/test/helpers/acceptance.rb +79 -0
  65. data/test/helpers/expectations/be_a.rb +23 -0
  66. data/test/helpers/expectations/change.rb +90 -0
  67. data/test/helpers/expectations/have.rb +105 -0
  68. data/test/helpers/expectations/predicates.rb +37 -0
  69. data/test/helpers/expectations.rb +4 -0
  70. data/test/helpers/fixtures.rb +87 -0
  71. data/test/helpers/initial_migration_fixture.sql +44 -0
  72. data/test/helpers.rb +87 -0
  73. data/test/unit/build_test.rb +86 -0
  74. data/test/unit/commit_test.rb +62 -0
  75. data/test/unit/helpers_test.rb +103 -0
  76. data/test/unit/integrity_test.rb +52 -0
  77. data/test/unit/migrations_test.rb +57 -0
  78. data/test/unit/notifier/base_test.rb +43 -0
  79. data/test/unit/notifier/test_test.rb +29 -0
  80. data/test/unit/notifier_test.rb +85 -0
  81. data/test/unit/project_builder_test.rb +118 -0
  82. data/test/unit/project_test.rb +371 -0
  83. data/test/unit/scm_test.rb +54 -0
  84. data/views/_commit_info.haml +24 -0
  85. data/views/build.haml +2 -0
  86. data/views/error.haml +37 -0
  87. data/views/home.haml +21 -0
  88. data/views/integrity.sass +400 -0
  89. data/views/layout.haml +29 -0
  90. data/views/new.haml +50 -0
  91. data/views/not_found.haml +31 -0
  92. data/views/notifier.haml +7 -0
  93. data/views/project.builder +21 -0
  94. data/views/project.haml +30 -0
  95. data/views/unauthorized.haml +38 -0
  96. metadata +327 -0
@@ -0,0 +1,118 @@
1
+ require File.dirname(__FILE__) + "/../helpers"
2
+
3
+ class ProjectBuilderTest < Test::Unit::TestCase
4
+ before(:all) do
5
+ unless File.directory?(Integrity.config[:export_directory])
6
+ FileUtils.mkdir(Integrity.config[:export_directory])
7
+ end
8
+
9
+ @directory = Integrity.config[:export_directory] + "/foca-integrity-master"
10
+ FileUtils.mkdir(@directory)
11
+ end
12
+
13
+ after(:all) do
14
+ FileUtils.rm_rf(@directory)
15
+ end
16
+
17
+ before(:each) do
18
+ @project = Integrity::Project.generate(:integrity, :command => "echo 'output!'")
19
+ ignore_logs!
20
+ end
21
+
22
+ it "creates a new SCM with given project's uri, branch and export_directory" do
23
+ SCM::Git.expects(:new).with(@project.uri, @project.branch, @directory)
24
+ ProjectBuilder.new(@project)
25
+ end
26
+
27
+ describe "When building" do
28
+ before(:each) do
29
+ @commit = @project.commits.gen(:pending)
30
+ end
31
+
32
+ it "sets the started and completed timestamps" do
33
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
34
+ SCM::Git.any_instance.expects(:info).returns({})
35
+
36
+ build = ProjectBuilder.new(@project).build(@commit)
37
+ build.output.should == "output!\n"
38
+ build.started_at.should_not be_nil
39
+ build.completed_at.should_not be_nil
40
+ build.should be_successful
41
+ end
42
+
43
+ it "ensures completed_at is set, even if something horrible happens" do
44
+ lambda {
45
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).raises
46
+ SCM::Git.any_instance.expects(:info).returns({})
47
+
48
+ build = ProjectBuilder.new(@project).build(@commit)
49
+ build.started_at.should_not be_nil
50
+ build.completed_at.should_not be_nil
51
+ build.should be_failed
52
+ }.should raise_error
53
+ end
54
+
55
+ it "sets the build status to failure when the build command exits with a non-zero status" do
56
+ @project.update_attributes(:command => "exit 1")
57
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
58
+ SCM::Git.any_instance.expects(:info).returns({})
59
+
60
+ build = ProjectBuilder.new(@project).build(@commit)
61
+ build.should be_failed
62
+ end
63
+
64
+ it "sets the build status to success when the build command exits with a zero status" do
65
+ @project.update_attributes(:command => "exit 0")
66
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
67
+ SCM::Git.any_instance.expects(:info).returns({})
68
+
69
+ build = ProjectBuilder.new(@project).build(@commit)
70
+ build.should be_successful
71
+ end
72
+
73
+ it "runs the command in the export directory" do
74
+ @project.update_attributes(:command => "cat foo.txt")
75
+ File.open(@directory + "/foo.txt", "w") { |file| file << "bar!" }
76
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
77
+ SCM::Git.any_instance.expects(:info).returns({})
78
+
79
+ build = ProjectBuilder.new(@project).build(@commit)
80
+ build.output.should == "bar!"
81
+ end
82
+
83
+ it "captures both stdout and stderr" do
84
+ @project.update_attributes(:command => "echo foo through out && echo bar through err 1>&2")
85
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
86
+ SCM::Git.any_instance.expects(:info).returns({})
87
+
88
+ build = ProjectBuilder.new(@project).build(@commit)
89
+ build.output.should == "foo through out\nbar through err\n"
90
+ end
91
+
92
+ it "raises SCMUnknownError if it can't figure the scm from the uri" do
93
+ @project.update_attributes(:uri => "scm://example.org")
94
+ lambda { ProjectBuilder.new(@project) }.should raise_error(SCM::SCMUnknownError)
95
+ end
96
+
97
+ it "doesn't fail if the commit identifier can't be retrieved" do
98
+ SCM::Git.any_instance.expects(:with_revision).with(@commit.identifier).yields
99
+ SCM::Git.any_instance.expects(:info).returns(false)
100
+ lambda {
101
+ ProjectBuilder.new(@project).build(@commit)
102
+ }.should_not raise_error
103
+ end
104
+ end
105
+
106
+ describe "When deleting the code from disk" do
107
+ it "destroys the directory" do
108
+ lambda do
109
+ ProjectBuilder.new(@project).delete_code
110
+ end.should change(Pathname.new(@directory), :directory?).from(true).to(false)
111
+ end
112
+
113
+ it "don't complains if the directory doesn't exists" do
114
+ Pathname.new(@directory).should_not be_directory
115
+ lambda { ProjectBuilder.new(@project).delete_code }.should_not raise_error
116
+ end
117
+ end
118
+ end
@@ -0,0 +1,371 @@
1
+ require File.dirname(__FILE__) + "/../helpers"
2
+
3
+ class ProjectTest < Test::Unit::TestCase
4
+ before(:each) do
5
+ RR.reset
6
+ ignore_logs!
7
+ end
8
+
9
+ specify "default fixture is valid and can be saved" do
10
+ lambda do
11
+ Project.generate.tap do |project|
12
+ project.should be_valid
13
+ project.save
14
+ end
15
+ end.should change(Project, :count).by(1)
16
+ end
17
+
18
+ specify "integrity fixture is valid and can be saved" do
19
+ lambda do
20
+ Project.generate(:integrity).tap do |project|
21
+ project.should be_valid
22
+ project.save
23
+ end
24
+ end.should change(Project, :count).by(1)
25
+ end
26
+
27
+ describe "Properties" do
28
+ before(:each) do
29
+ @project = Project.generate(:integrity)
30
+ end
31
+
32
+ it "has a name" do
33
+ @project.name.should == "Integrity"
34
+ end
35
+
36
+ it "has a permalink" do
37
+ @project.permalink.should == "integrity"
38
+
39
+ @project.tap do |project|
40
+ project.name = "foo's bar/baz and BACON?!"
41
+ project.save
42
+ end.permalink.should == "foos-bar-baz-and-bacon"
43
+ end
44
+
45
+ it "has an URI" do
46
+ @project.uri.should == Addressable::URI.parse("git://github.com/foca/integrity.git")
47
+ end
48
+
49
+ it "has a branch" do
50
+ @project.branch.should == "master"
51
+ end
52
+
53
+ specify "branch defaults to master" do
54
+ Project.new.branch.should == "master"
55
+ end
56
+
57
+ it "has a command" do
58
+ # TODO: rename to build_command
59
+ @project.command.should == "rake"
60
+ end
61
+
62
+ specify "command defaults to 'rake'" do
63
+ Project.new.command.should == "rake"
64
+ end
65
+
66
+ it "has a building flag" do
67
+ @project.should_not be_building
68
+ end
69
+
70
+ specify "building flag default to false" do
71
+ Project.new.should_not be_building
72
+ end
73
+
74
+ it "knows it's visibility" do
75
+ # TODO: rename Project#public property to visibility
76
+ # TODO: and have utility method to query its state instead
77
+
78
+ Project.new.should be_public
79
+
80
+ @project.should be_public
81
+ @project.tap { |p| p.public = "1" }.should be_public
82
+ @project.tap { |p| p.public = "0" }.should_not be_public
83
+
84
+ Project.gen(:public => "false").should be_public
85
+ Project.gen(:public => "true").should be_public
86
+ Project.gen(:public => false).should_not be_public
87
+ Project.gen(:public => nil).should_not be_public
88
+ end
89
+
90
+ it "has a created_at" do
91
+ @project.created_at.should be_a(DateTime)
92
+ end
93
+
94
+ it "has an updated_at" do
95
+ @project.updated_at.should be_a(DateTime)
96
+ end
97
+
98
+ it "knows it's status" do
99
+ Project.gen(:commits => 1.of{ Commit.gen(:successful) }).status.should == :success
100
+ Project.gen(:commits => 2.of{ Commit.gen(:successful) }).status.should == :success
101
+ Project.gen(:commits => 2.of{ Commit.gen(:failed) }).status.should == :failed
102
+ Project.gen(:commits => 1.of{ Commit.gen(:pending) }).status.should == :pending
103
+ Project.gen(:commits => []).status.should be_nil
104
+ end
105
+
106
+ it "knows it's last build" do
107
+ Project.gen(:commits => []).last_commit.should be_nil
108
+
109
+ commits = 5.of { Commit.gen(:successful) }
110
+ project = Project.gen(:commits => commits)
111
+ project.last_commit.should == commits.sort_by {|c| c.committed_at }.last
112
+ end
113
+
114
+ test "deprecated properties" do
115
+ silence_warnings {
116
+ @project.last_build.should == @project.last_commit
117
+ @project.previous_builds.should == @project.previous_commits
118
+ }
119
+ end
120
+ end
121
+
122
+ describe "Validation" do
123
+ it "requires a name" do
124
+ lambda do
125
+ Project.gen(:name => nil).should_not be_valid
126
+ end.should_not change(Project, :count)
127
+ end
128
+
129
+ it "requires an URI" do
130
+ lambda do
131
+ Project.gen(:uri => nil).should_not be_valid
132
+ end.should_not change(Project, :count)
133
+ end
134
+
135
+ it "requires a branch" do
136
+ lambda do
137
+ Project.gen(:branch => nil).should_not be_valid
138
+ end.should_not change(Project, :count)
139
+ end
140
+
141
+ it "requires a command" do
142
+ lambda do
143
+ Project.gen(:command => nil).should_not be_valid
144
+ end.should_not change(Project, :count)
145
+ end
146
+
147
+ it "ensures its name is unique" do
148
+ Project.gen(:name => "Integrity")
149
+ lambda do
150
+ Project.gen(:name => "Integrity").should_not be_valid
151
+ end.should_not change(Project, :count)
152
+ end
153
+ end
154
+
155
+ describe "Finding public or private projects" do
156
+ before(:each) do
157
+ @public_project = Project.gen(:public => true)
158
+ @private_project = Project.gen(:public => false)
159
+ end
160
+
161
+ it "finds only public projects if the condition passed is false" do
162
+ projects = Project.only_public_unless(false)
163
+ projects.should_not include(@private_project)
164
+ projects.should include(@public_project)
165
+ end
166
+
167
+ it "finds both private and public projects if the condition passed is true" do
168
+ projects = Project.only_public_unless(true)
169
+ projects.should include(@private_project)
170
+ projects.should include(@public_project)
171
+ end
172
+ end
173
+
174
+ describe "When finding its previous builds" do
175
+ before(:each) do
176
+ @project = Project.generate(:commits => 5.of { Commit.gen })
177
+ @commits = @project.commits.sort_by {|c| c.committed_at }.reverse
178
+ end
179
+
180
+ it "has 4 previous builds" do
181
+ @project.should have(4).previous_commits
182
+ end
183
+
184
+ it "returns the builds ordered chronogicaly (desc) by creation date" do
185
+ @project.previous_commits.should == @commits[1..-1]
186
+ end
187
+
188
+ it "excludes the last build" do
189
+ @project.previous_commits.should_not include(@project.last_commit)
190
+ end
191
+
192
+ it "returns an empty array if it has only one build" do
193
+ project = Project.gen(:commits => 1.of { Integrity::Commit.gen })
194
+ project.should have(:no).previous_commits
195
+ end
196
+
197
+ it "returns an empty array if there are no builds" do
198
+ project = Project.gen(:commits => [])
199
+ project.should have(:no).previous_commits
200
+ end
201
+ end
202
+
203
+ describe "When getting destroyed" do
204
+ before(:each) do
205
+ @commits = 7.of { Commit.gen }
206
+ @project = Project.generate(:commits => @commits)
207
+ end
208
+
209
+ it "destroys itself and tell ProjectBuilder to delete the code from disk" do
210
+ lambda do
211
+ stub.instance_of(ProjectBuilder).delete_code
212
+ @project.destroy
213
+ end.should change(Project, :count).by(-1)
214
+ end
215
+
216
+ it "destroys its builds" do
217
+ lambda do
218
+ @project.destroy
219
+ end.should change(Commit, :count).by(-7)
220
+ end
221
+ end
222
+
223
+ describe "When updating its notifiers" do
224
+ setup do
225
+ twitter = Notifier.gen(:twitter, :enabled => true)
226
+ irc = Notifier.gen(:irc, :enabled => false)
227
+
228
+ @project = Project.gen(:notifiers => [twitter, irc])
229
+ end
230
+
231
+ it "creates and enable the given notifiers" do
232
+ Notifier.all.destroy!
233
+
234
+ project = Project.gen
235
+ project.update_notifiers(["IRC", "Twitter"],
236
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
237
+ "Twitter" => {"username" => "john"}})
238
+
239
+ assert_equal 2, Notifier.count
240
+ assert_equal 2, project.enabled_notifiers.count
241
+ assert_equal "IRC", project.notifiers.first.name
242
+ assert_equal "Twitter", project.notifiers.last.name
243
+
244
+ project.update_notifiers(["Twitter"],
245
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
246
+ "Twitter" => {"username" => "john"}})
247
+
248
+ assert_equal 2, Notifier.count
249
+ assert ! project.notifies?("IRC")
250
+ assert project.notifies?("Twitter")
251
+ end
252
+
253
+ it "creates notifiers present in config even when they're disabled" do
254
+ @project.update_notifiers(["IRC"],
255
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
256
+ "Twitter" => {"username" => "john"}})
257
+
258
+ assert_equal 2, @project.notifiers.count
259
+ end
260
+
261
+ it "disables notifiers that are not included in the list" do
262
+ @project.update_notifiers(["IRC"],
263
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
264
+ "Twitter" => {"username" => "john"}})
265
+
266
+ @project.update_notifiers(["IRC"],
267
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"}})
268
+
269
+ assert ! @project.notifiers.first(:name => "Twitter").enabled?
270
+ assert @project.notifiers.first(:name => "IRC").enabled?
271
+ end
272
+
273
+ it "preserves config of notifiers that are being disabled" do
274
+ @project.update_notifiers(["IRC"],
275
+ {"IRC" => {"uri" => "irc://irc.freenode.net/integrity"},
276
+ "Twitter" => {"username" => "john"}})
277
+
278
+ assert_equal "john",
279
+ @project.notifiers.first(:name => "Twitter").config["username"]
280
+ end
281
+
282
+ it "does nothing if given nil as the list of notifiers to enable" do
283
+ lambda { Project.gen.update_notifiers(nil, {}) }.should_not change(Notifier, :count)
284
+ end
285
+
286
+ it "doesn't destroy any of the other notifiers that exist for other projects" do
287
+ irc = Notifier.generate(:irc)
288
+
289
+ project = Project.gen
290
+ project.update_notifiers("IRC", {"IRC" => irc.config})
291
+
292
+ lambda {
293
+ Project.gen.update_notifiers("IRC", {"IRC" => irc.config})
294
+ }.should_not change(project.notifiers, :count)
295
+ end
296
+ end
297
+
298
+ describe "When retrieving state about its notifier" do
299
+ before(:each) do
300
+ @project = Project.gen
301
+ @irc = Notifier.generate(:irc)
302
+ end
303
+
304
+ it "knows which notifiers are enabled" do
305
+ notifiers = [Notifier.gen(:irc, :enabled => false),
306
+ Notifier.gen(:twitter, :enabled => true)]
307
+ project = Project.gen(:notifiers => notifiers)
308
+
309
+ assert_equal 1, project.enabled_notifiers.size
310
+ end
311
+
312
+ specify "#config_for returns given notifier's configuration" do
313
+ @project.update_attributes(:notifiers => [@irc])
314
+ @project.config_for("IRC").should == {:uri => "irc://irc.freenode.net/integrity"}
315
+ end
316
+
317
+ specify "#config_for returns an empty hash for unknown notifier" do
318
+ @project.config_for("IRC").should == {}
319
+ end
320
+
321
+ specify "#notifies? is true if the notifier exists and is enabled" do
322
+ assert ! @project.notifies?("UndefinedNotifier")
323
+
324
+ @project.update_attributes(:notifiers =>
325
+ [ Notifier.gen(:irc, :enabled => true),
326
+ Notifier.gen(:twitter, :enabled => false) ])
327
+
328
+ assert @project.notifies?("IRC")
329
+ assert ! @project.notifies?("Twitter")
330
+ end
331
+ end
332
+
333
+ describe "When building a commit" do
334
+ before(:each) do
335
+ @commits = 2.of { Commit.gen }
336
+ @project = Project.gen(:integrity, :commits => @commits)
337
+ stub.instance_of(ProjectBuilder).build { nil }
338
+ end
339
+
340
+ it "gets the specified commit and creates a pending build for it" do
341
+ commit = @commits.last
342
+
343
+ lambda {
344
+ @project.build(commit.identifier)
345
+ }.should change(Build, :count).by(1)
346
+
347
+ build = Build.all.last
348
+ build.commit.should be(commit)
349
+ build.should be_pending
350
+
351
+ commit.should be_pending
352
+ end
353
+
354
+ it "creates an empty commit with the head of the project if passed 'HEAD' (the default)" do
355
+ mock(@project).head_of_remote_repo { "FOOBAR" }
356
+
357
+ lambda {
358
+ @project.build("HEAD")
359
+ }.should change(Commit, :count).by(1)
360
+
361
+ build = Build.all.last
362
+ build.commit.should be(@project.last_commit)
363
+
364
+ @project.last_commit.should be_pending
365
+ @project.last_commit.identifier.should be("FOOBAR")
366
+
367
+ @project.last_commit.author.name.should == "<Commit author not loaded>"
368
+ @project.last_commit.message.should == "<Commit message not loaded>"
369
+ end
370
+ end
371
+ end
@@ -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.commited_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