Permalink
Browse files

Add support for processing multiple [StoryXXX] blocks in same commit …

…message
  • Loading branch information...
1 parent 44ff6f7 commit e5935f327923d3836cca0a7ec81a5285408e8580 @apinstein apinstein committed Jun 15, 2009
Showing with 7 additions and 5 deletions.
  1. +3 −0 config.yml
  2. +1 −1 test.rb
  3. +3 −4 tracker_github_hook.rb
View
@@ -2,11 +2,14 @@ neybor:
github_url: 'http://github.com/apinstein/neybor'
tracker_api_token: a00fbc0b53e13a8ad1c8f01b19b0537b
tracker_project_id: 13545
+ ref: refs/heads/master
tourbuzz:
github_url: 'http://github.com/apinstein/tourbuzz'
tracker_api_token: a00fbc0b53e13a8ad1c8f01b19b0537b
tracker_project_id: 15381
+ ref: refs/heads/master
tourbuzzplayer:
github_url: 'http://github.com/lorennorman/tourbuzz-panoviewer'
tracker_api_token: a00fbc0b53e13a8ad1c8f01b19b0537b
tracker_project_id: 15381
+ ref: refs/heads/master
View
@@ -27,7 +27,7 @@
"email": "chris@cobaltedge.com",
"name": "Chris Bailey"
},
- "message": "This one is a comment only 10 [Story294825]",
+ "message": "This one is a comment only 10 [Story294825] and [Story1234] 2nd line commit",
"timestamp": "2008-02-15T14:57:17-08:00",
"added": ["filepath.rb"]
},
View
@@ -59,18 +59,17 @@ def process_commit(tracker_info, commit)
message = commit['message']
# see if there is a Tracker story trigger, and if so, get story ID
- tracker_trigger = message.match(/\[Story(\d+)(.*)\]/)
- if tracker_trigger
+ message.scan(/\[Story(\d+)([^\]]*)\]/) do |tracker_trigger|
@num_commits += 1
- story_id = tracker_trigger[1]
+ story_id = tracker_trigger[0]
# post comment to the story
RestClient.post(create_api_url(tracker_info[:project_id], story_id, '/notes'),
"<note><text>(from [#{commit['id']}]) #{message}</text></note>",
tracker_api_headers(tracker_info[:api_token]))
# See if we have a state change
- state = tracker_trigger[2].match(/.*state:(\s?\w+).*/)
+ state = tracker_trigger[1].match(/.*state:(\s?\w+).*/)
if state
state = state[1].strip

0 comments on commit e5935f3

Please sign in to comment.