Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Use proper count of number of commits we processed for stories.

  • Loading branch information...
commit e4a1aad0222e07e8003b50196c0109dd106ad915 1 parent ee27961
Chris Bailey authored December 02, 2008
11  test.rb
@@ -32,6 +32,17 @@
32 32
       "added": ["filepath.rb"]
33 33
     },
34 34
     {
  35
+      "id": "41a212ee83ca321e3c8cf465891cb7216a705f59",
  36
+      "url": "http://github.com/defunkt/github/commit/41a212ee83ca127e3c8cf465891ab7216a705f59",
  37
+      "author": {
  38
+        "email": "chris@cobaltedge.com",
  39
+        "name": "Chris Bailey" 
  40
+      },
  41
+      "message": "This one does not have a story association",
  42
+      "timestamp": "2008-02-15T14:58:17-08:00",
  43
+      "added": ["filepath.rb"]
  44
+    },
  45
+    {
35 46
       "id": "de8251ff97ee194a289832576287d6f8ad74e3d0",
36 47
       "url": "http://github.com/defunkt/github/commit/de8251ff97ee194a289832576287d6f8ad74e3d0",
37 48
       "author": {
5  tracker_github_hook.rb
@@ -38,11 +38,11 @@
38 38
 
39 39
 # The handler for the GitHub post-receive hook
40 40
 post '/' do
  41
+  @num_commits = 0
41 42
   push = JSON.parse(params[:payload])
42 43
   tracker_info = PROJECTS[push['repository']['url']]
43 44
   push['commits'].each { |commit| process_commit(tracker_info, commit) }
44  
-  num_commits = push['commits'].length
45  
-  "Processed #{num_commits} commits"
  45
+  "Processed #{@num_commits} commits for stories"
46 46
 end
47 47
 
48 48
   
@@ -54,6 +54,7 @@ def process_commit(tracker_info, commit)
54 54
     # see if there is a Tracker story trigger, and if so, get story ID
55 55
     tracker_trigger = message.match(/\[Story(\d+)(.*)\]/)
56 56
     if tracker_trigger
  57
+      @num_commits += 1
57 58
       story_id = tracker_trigger[1]
58 59
     
59 60
       # post comment to the story

0 notes on commit e4a1aad

Please sign in to comment.
Something went wrong with that request. Please try again.