Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Commit

Permalink
feat(redmine): Redmineのチケット作成追加
Browse files Browse the repository at this point in the history
  • Loading branch information
satoshun00 committed Nov 7, 2014
1 parent 6f48fac commit cfc4448
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 116 deletions.
6 changes: 4 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM node:latest

RUN mkdir /bot
RUN mkdir /bot && cd /bot

ADD . /bot

EXPOSE 9999

CMD cd /bot; bin/hubot --adapter slack
WORKDIR /bot

CMD ["bin/hubot", "--adapter", "slack"]
19 changes: 14 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,7 @@ Where `<adapter>` is the name of your adapter without the `hubot-` prefix.

[hubot-adapters]: https://github.com/github/hubot/blob/master/docs/adapters.md

fennecbot
=========
# fennecbot

### Installation

Expand All @@ -111,11 +110,21 @@ docker build -t fenneclab/fennecbot .
### Run

```
docker run -e HUBOT_SLACK_TOKEN="***" \
-e HUBOT_SLACK_TEAM="***" \
-e HUBOT_SLACK_BOTNAME="fennec.bot" \
docker run -e HUBOT_SLACK_TOKEN="${HUBOT_SLACK_TOKEN}" \
-e HUBOT_SLACK_TEAM="${HUBOT_SLACK_TEAM}" \
-e HUBOT_SLACK_BOTNAME="${HUBOT_SLACK_BOTNAME}" \
-e PORT=9999 \
-e HUBOT_REDMINE_BASE_URL="${HUBOT_REDMINE_BASE_URL}" \
-e HUBOT_REDMINE_TOKEN="${HUBOT_REDMINE_TOKEN}" \
-d -p 9999:9999 \
-v "$(pwd)":/bot \
fenneclab/fennecbot
# or shell mode
docker run -v "$(pwd)":/bot \
-it -p 9999:9999 \
-e HUBOT_REDMINE_TOKEN="${HUBOT_REDMINE_TOKEN}" \
-e HUBOT_REDMINE_BASE_URL="${HUBOT_REDMINE_BASE_URL}" \
fenneclab/fennecbot \
bin/hubot
```
3 changes: 1 addition & 2 deletions hubot-scripts.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[
"google.coffee",
"redmine.coffee"
"google.coffee"
]
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
"hubot-redis-brain": "0.0.2",
"hubot-scripts": "^2.5.16",
"hubot-slack": "^2.2.0",
"hubot-youtube": "^0.1.2"
"hubot-youtube": "^0.1.2",
"request": "^2.47.0"
},
"engines": {
"node": "0.10.x"
Expand Down
106 changes: 0 additions & 106 deletions scripts/example.coffee

This file was deleted.

34 changes: 34 additions & 0 deletions scripts/redmine.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Description:
# Redmineにチケットを登録する
#
# Configuration:
# HUBOT_REDMINE_BASE_URL
# HUBOT_REDMINE_TOKEN
#
# Commands:
# hubot redmine create <subject> - RedmineのBuddyプロジェクトにチケットを登録します
#
# Author:
# satoshun00

request = require 'request'

module.exports = (robot) ->
robot.respond /redmine create (.+)$/i, (msg) ->
data =
issue:
project_id: 'Buddy'
subject: msg.match[1]
url = process.env.HUBOT_REDMINE_BASE_URL.replace /\/$/, ''
request
url: url + '/issues.json'
method: 'POST'
headers:
Accept: 'application/json'
"X-Redmine-API-Key": process.env.HUBOT_REDMINE_TOKEN
json: true
body: data
, (err, res, body) ->
msg.send '@satoshun00 Redmineのチケット作成に失敗したよ =͟͟͞͞((☞ ՞ਊ ՞)☞' + err if err?
if body?
msg.send '◜◡‾)◞つくたよ http://redmine.fenneclab.com/issues/' + body.issue.id

0 comments on commit cfc4448

Please sign in to comment.