Skip to content

Commit

Permalink
Fixed bug with performing the http.get inside the loop of each build.
Browse files Browse the repository at this point in the history
  • Loading branch information
lukesmith committed Oct 30, 2011
1 parent 9303c1c commit 8de63a6
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/scripts/teamcity.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ module.exports = (robot) ->
return
# Sort by build number.
builds = JSON.parse(body).build.sort((a, b)-> parseInt(b.number) - parseInt(a.number))
for build in builds

displayBuild = (msg, build) ->
msg.http("http://#{hostname}#{build.href}")
.headers(Authorization: "Basic #{new Buffer("#{username}:#{password}").toString("base64")}", Accept: "application/json")
.get() (err, res, body) ->
Expand All @@ -39,4 +40,7 @@ module.exports = (robot) ->
else if build.status is "SUCCESS"
msg.send "#{project.buildType.projectName} - #{build.number} is full of win"
else if build.status is "FAILUED"
msg.send "#{project.buildType.projectName} - #{build.number} is #fail"
msg.send "#{project.buildType.projectName} - #{build.number} is #fail"

for build in builds
displayBuild(msg, build)

0 comments on commit 8de63a6

Please sign in to comment.