UNPKG

1.1 kBtext/coffeescriptView Raw
1# Description:
2# BitBucket Pull Requests
3#
4# Dependencies:
5# None
6#
7# Commands:
8# list pull-requests - Display opened pull requests
9# list pull-requests for <repository-slug> - Display opened pull requests for repository-slug
10#
11# Author:
12# jgfraga
13
14pullRequests = require './libs/bitbucket'
15
16############################
17# Api Methods
18############################
19
20ensureConfig = (out) ->
21 out "Error: BitBucket Auth username is not specified" if not process.env.HUBOT_BITBUCKET_AUTH_USER
22 out "Error: BitBucket Auth password is not specified" if not process.env.HUBOT_BITBUCKET_AUTH_PASS
23 out "Error: BitBucket repositories list is not specified" if not process.env.HUBOT_BITBUCKET_REPOSITORIES
24 return false unless (process.env.HUBOT_BITBUCKET_AUTH_USER and process.env.HUBOT_BITBUCKET_AUTH_PASS and process.env.HUBOT_BITBUCKET_REPOSITORIES)
25 true
26
27module.exports = (robot) ->
28 ensureConfig console.log
29
30 robot.respond /list (\w.+) pull-requests/i, (msg) ->
31 pullRequests.summary msg, msg.match[1]
32
33 robot.respond /list pull-requests/, (msg) ->
34 pullRequests.summary msg