bobette 0.0.5 → 0.0.6
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.md +22 -11
- data/bobette.gemspec +2 -2
- data/lib/bobette/github.rb +2 -2
- data/test/bobette_github_test.rb +23 -8
- data/test/bobette_test.rb +3 -3
- data/test/helper/builder_stub.rb +1 -1
- metadata +3 -3
data/README.md
CHANGED
@@ -1,17 +1,28 @@
|
|
1
1
|
# Bobette — Bob's sister
|
2
2
|
|
3
|
-
Bobette is a [Rack]
|
4
|
-
|
5
|
-
|
3
|
+
Bobette is a [Rack](http://rack.rubyforge.org) app that will turn the payload
|
4
|
+
specified in the `bobette.payload` Rack env key into a buildable object and
|
5
|
+
then build it using [Bob](http://github.com/integrity/bob).
|
6
6
|
|
7
|
-
|
8
|
-
|
7
|
+
It also provides middlewares to normalize the payload format used
|
8
|
+
by code hosting services into a common format:
|
9
9
|
|
10
|
-
|
10
|
+
{"scm" => "git",
|
11
|
+
"uri" => "git@github.com:integrity/integrity",
|
12
|
+
"branch" => "master",
|
13
|
+
"commits" =>
|
14
|
+
[{"id" => "c6dd001c1a95763b2ea62201b73005a6b86c048e",
|
15
|
+
"message" => "Add rip files",
|
16
|
+
"author" => {"name" => "Simon Rozet", :email => "simon@rozet.name"},
|
17
|
+
"timestamp" => "2009-09-30T06:16:12-07:00"}]}
|
18
|
+
|
19
|
+
Only [GitHub](http://github.com) is supported so fare but it's easy to add
|
20
|
+
support for other code hosting services.
|
11
21
|
|
12
|
-
|
13
|
-
|
22
|
+
Checkout [Integrity](http://integrityapp.com) for a full fledged automated
|
23
|
+
Continuous Integration server.
|
24
|
+
|
25
|
+
## Acknowledgement
|
14
26
|
|
15
|
-
[
|
16
|
-
|
17
|
-
[Integrity]: http://github.com/integrity/integrity
|
27
|
+
Thanks a lot to [Tim Carey-Smith](http://github.com/halorgium) for his early
|
28
|
+
feedback.
|
data/bobette.gemspec
CHANGED
data/lib/bobette/github.rb
CHANGED
@@ -15,9 +15,9 @@ module Bobette
|
|
15
15
|
payload["uri"] = uri(payload.delete("repository"))
|
16
16
|
payload["branch"] = payload.delete("ref").split("/").last
|
17
17
|
if (head = payload.delete("after")) && @head.call
|
18
|
-
payload["commits"] = [head]
|
18
|
+
payload["commits"] = [payload["commits"].detect{|c| c["id"] == head }]
|
19
19
|
else
|
20
|
-
payload["commits"] = payload.delete("commits")
|
20
|
+
payload["commits"] = payload.delete("commits")
|
21
21
|
end
|
22
22
|
@app.call(env.update("bobette.payload" => payload))
|
23
23
|
rescue JSON::JSONError
|
data/test/bobette_github_test.rb
CHANGED
@@ -21,15 +21,23 @@ class BobetteGitHubTest < Bobette::TestCase
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def test_transform_payload
|
24
|
-
commits = JSON.parse(@payload)["commits"]
|
24
|
+
commits = JSON.parse(@payload)["commits"]
|
25
25
|
|
26
26
|
post("/", :payload => @payload) { |response|
|
27
|
+
payload = JSON.parse(response.body)
|
28
|
+
|
27
29
|
assert response.ok?
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
30
|
+
|
31
|
+
assert_equal "git", payload["scm"]
|
32
|
+
assert_equal "git://github.com/sr/bob", payload["uri"]
|
33
|
+
assert_equal "master", payload["branch"]
|
34
|
+
assert_equal 2, payload["commits"].size
|
35
|
+
|
36
|
+
commit = payload["commits"].first
|
37
|
+
|
38
|
+
assert_equal "c6dd001c1a95763b2ea62201b73005a6b86c048e", commit["id"]
|
39
|
+
assert_match /instead of private #path method/, commit["message"]
|
40
|
+
assert_equal "2009-09-30T06:10:44-07:00", commit["timestamp"]
|
33
41
|
}
|
34
42
|
end
|
35
43
|
|
@@ -46,9 +54,16 @@ class BobetteGitHubTest < Bobette::TestCase
|
|
46
54
|
def test_head_commit
|
47
55
|
$head = true
|
48
56
|
post("/", :payload => @payload) { |response|
|
57
|
+
payload = JSON.parse(response.body)
|
58
|
+
|
49
59
|
assert response.ok?
|
50
|
-
assert_equal ["
|
51
|
-
|
60
|
+
assert_equal 1, payload["commits"].size
|
61
|
+
|
62
|
+
commit = payload["commits"].first
|
63
|
+
|
64
|
+
assert_equal "b2f5af7a7cd70e69d1145a6b4ddbf87df22bd343", commit["id"]
|
65
|
+
assert_equal "Add rip files", commit["message"]
|
66
|
+
assert_equal "2009-09-30T06:16:12-07:00", commit["timestamp"]
|
52
67
|
}
|
53
68
|
end
|
54
69
|
|
data/test/bobette_test.rb
CHANGED
@@ -10,7 +10,7 @@ class BobetteTest < Bobette::TestCase
|
|
10
10
|
|
11
11
|
def payload(repo)
|
12
12
|
{ "branch" => repo.branch,
|
13
|
-
"commits" => repo.commits
|
13
|
+
"commits" => repo.commits,
|
14
14
|
"uri" => repo.uri.to_s,
|
15
15
|
"scm" => repo.scm }
|
16
16
|
end
|
@@ -26,7 +26,7 @@ class BobetteTest < Bobette::TestCase
|
|
26
26
|
@builds = {}
|
27
27
|
|
28
28
|
Beacon.watch(:start) { |commit|
|
29
|
-
@id = commit["
|
29
|
+
@id = commit["id"]
|
30
30
|
@commits[@id] = commit
|
31
31
|
}
|
32
32
|
|
@@ -47,7 +47,7 @@ class BobetteTest < Bobette::TestCase
|
|
47
47
|
assert_equal "Running tests...\n", @builds[commit].last
|
48
48
|
assert_equal "This commit will fail", @commits[commit]["message"]
|
49
49
|
assert_equal "John Doe <johndoe@example.org>", @commits[commit]["author"]
|
50
|
-
assert_kind_of Time, @commits[commit]["
|
50
|
+
assert_kind_of Time, @commits[commit]["timestamp"]
|
51
51
|
end
|
52
52
|
|
53
53
|
def test_invalid_payload
|
data/test/helper/builder_stub.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: bobette
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "Nicol\xC3\xA1s Sanguinetti"
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2009-
|
13
|
+
date: 2009-11-06 00:00:00 +01:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -68,7 +68,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
68
68
|
requirements: []
|
69
69
|
|
70
70
|
rubyforge_project: integrity
|
71
|
-
rubygems_version: 1.3.
|
71
|
+
rubygems_version: 1.3.5
|
72
72
|
signing_key:
|
73
73
|
specification_version: 3
|
74
74
|
summary: Bob's sister
|