Skip to content

Commit

Permalink
Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
spraints committed Aug 13, 2012
1 parent 635096c commit b5391f8
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions scripts/moregithub.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@
module.exports = (robot) ->
github = require("githubot")(robot)

describe_issue = (msg, issue_number) ->
if isNaN(issue_number)
return
bot_github_repo = github.qualified_repo process.env.HUBOT_GITHUB_REPO

hey_github = (frag, callback) ->
console.log frag
github.get "https://api.github.com/repos/#{bot_github_repo}#{frag}", callback

bot_github_repo = github.qualified_repo process.env.HUBOT_GITHUB_REPO
issue_title = ""
github.get "https://api.github.com/repos/#{bot_github_repo}/issues/" + issue_number, (issue_obj) ->
describe_issue = (msg, issue_number) ->
return if isNaN(issue_number)
hey_github "/issues/" + issue_number, (issue_obj) ->
issue_title = issue_obj.title
msg.send "Issue " + issue_number + ": " + issue_title + " http://github.com/" + bot_github_repo + '/issues/' + issue_number

Expand All @@ -17,8 +19,7 @@ module.exports = (robot) ->
describe_issue msg, match.replace '#', ''

describe_commit = (msg, sha) ->
bot_github_repo = github.qualified_repo process.env.HUBOT_GITHUB_REPO
github.get "https://api.github.com/repos/#{bot_github_repo}/commits/" + sha, (commit_obj) ->
hey_github "/commits/" + sha, (commit_obj) ->
commit_message = commit_obj.commit.message
msg.send "Commit " + sha + ": " + commit_message + " http://github.com/" + bot_github_repo + "/commit/" + sha

Expand Down

0 comments on commit b5391f8

Please sign in to comment.