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 CHANGED
@@ -1,17 +1,28 @@
1
1
  # Bobette — Bob's sister
2
2
 
3
- Bobette is a [Rack][] app that will turn the payload specified
4
- via the `bobette.payload` Rack env key into a buildable object
5
- and then builds it using [Bob][].
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
- You probably don't care about this, though; check out [Integrity][]
8
- for a full fledged automated CI server or the test suite if you do.
7
+ It also provides middlewares to normalize the payload format used
8
+ by code hosting services into a common format:
9
9
 
10
- ## Acknowledgement
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
- Thanks a lot to [Tim Carey-Smith](http://github.com/halorgium) for
13
- all his very useful feedbacks.
22
+ Checkout [Integrity](http://integrityapp.com) for a full fledged automated
23
+ Continuous Integration server.
24
+
25
+ ## Acknowledgement
14
26
 
15
- [Rack]: http://rack.rubyforge.org
16
- [Bob]: http://github.com/integrity/bob
17
- [Integrity]: http://github.com/integrity/integrity
27
+ Thanks a lot to [Tim Carey-Smith](http://github.com/halorgium) for his early
28
+ feedback.
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "bobette"
3
- s.version = "0.0.5"
4
- s.date = "2009-10-10"
3
+ s.version = "0.0.6"
4
+ s.date = "2009-11-06"
5
5
 
6
6
  s.summary = "Bob's sister"
7
7
  s.description = "Bob's sister"
@@ -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").collect { |c| c["id"] }
20
+ payload["commits"] = payload.delete("commits")
21
21
  end
22
22
  @app.call(env.update("bobette.payload" => payload))
23
23
  rescue JSON::JSONError
@@ -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"].collect {|c| c["id"]}
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
- assert_equal(
29
- { "uri" => "git://github.com/sr/bob",
30
- "scm" => "git",
31
- "branch" => "master",
32
- "commits" => commits }, JSON.parse(response.body))
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 ["b2f5af7a7cd70e69d1145a6b4ddbf87df22bd343"],
51
- JSON.parse(response.body)["commits"]
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
 
@@ -10,7 +10,7 @@ class BobetteTest < Bobette::TestCase
10
10
 
11
11
  def payload(repo)
12
12
  { "branch" => repo.branch,
13
- "commits" => repo.commits.collect { |c| c["identifier"] },
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["identifier"]
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]["committed_at"]
50
+ assert_kind_of Time, @commits[commit]["timestamp"]
51
51
  end
52
52
 
53
53
  def test_invalid_payload
@@ -8,7 +8,7 @@ module Bobette::TestHelper
8
8
  return [] if no_buildable
9
9
 
10
10
  payload.delete("commits").collect { |c|
11
- new(payload.merge("command" => "./test", "commit" => c))
11
+ new(payload.merge("command" => "./test", "commit" => c["id"]))
12
12
  }
13
13
  end
14
14
 
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.5
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-10-10 00:00:00 +02:00
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.3
71
+ rubygems_version: 1.3.5
72
72
  signing_key:
73
73
  specification_version: 3
74
74
  summary: Bob's sister