Skip to content

Commit

Permalink
Merge pull request #8 from shaunburdick/2.0.0-alpha
Browse files Browse the repository at this point in the history
2.0.0 alpha
  • Loading branch information
shaunburdick committed Dec 25, 2015
2 parents 4240227 + ee5a7ca commit 9785c7c
Show file tree
Hide file tree
Showing 36 changed files with 826 additions and 4,865 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.git/*
coverage/*
doc/*
node_modules/*
8 changes: 8 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "airbnb/base",
"rules": {
"strict": 0,
"valid-jsdoc" : 2,
"no-eval": 0
}
}
5 changes: 2 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ ENV NODE_ENV=production \
JIRA_REGEX=([A-Z]{1}[A-Z0-9]+\-[0-9]+) \
JIRA_SPRINT_FIELD= \
SLACK_TOKEN=xoxb-foo \
SLACK_AUTO_RECONNECT=true \
SLACK_AUTO_MARK=true
SLACK_AUTO_RECONNECT=true

ADD . /usr/src/myapp

WORKDIR /usr/src/myapp

RUN ["npm", "install"]

CMD ["npm", "start"]
CMD ["npm", "start"]
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This slack bot will listen on any channel it's on for JIRA tickets. It will look
## Install
1. Clone this [repository](https://github.com/shaunburdick/slack-jirabot.git)
2. `npm install`
3. Copy `./release/js/config.default.js` to `./release/js/config.js` and [fill it out](#configjs)
3. Copy `./config.default.js` to `./config.js` and [fill it out](#configjs)
4. `npm start`

## Test
Expand Down Expand Up @@ -41,7 +41,6 @@ The config file should be filled out as follows:
- slack:
- token: string, Your slack token
- autoReconnect: boolean, Reconnect on disconnect
- autoMark: boolean, Mark messages as read

- usermap:
- Map a JIRA username to a Slack username
Expand All @@ -67,7 +66,6 @@ You can set the configuration of the bot by using environment variables. _ENVIRO
- _JIRA_SPRINT_FIELD_=, if using greenhopper, set the custom field that holds sprint information (customfield_xxxxx)
- _SLACK_TOKEN_=xoxb-foo, Your Slack Token
- _SLACK_AUTO_RECONNECT_=true, Reconnect on disconnect
- _SLACK_AUTO_MARK_=true, Mark messages as read

Set them using the `-e` flag while running docker:

Expand Down
35 changes: 35 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
'use strict';

const logger = require('./lib/logger')();
const redact = require('redact-object');
const Bot = require('./lib/bot');
const Config = require('./lib/config');

let bot;
let config;

/**
* Load config
*/
const rawConfig = (() => {
let retVal;
try {
retVal = require('./config');
} catch (exception) {
retVal = require('./config.default');
}

return retVal;
})();

try {
config = Config.parse(rawConfig);
} catch (error) {
logger.error('Could not parse config', error);
process.exit(1);
}

logger.info('Using the following configuration:', redact(config, ['token', 'pass']));

bot = new Bot(config);
bot.start();
24 changes: 24 additions & 0 deletions config.default.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
'use strict';

const config = {
jira: {
protocol: 'https',
host: 'jira.yourhost.domain',
port: 443,
base: '',
user: 'username',
pass: 'password',
apiVersion: 'latest',
verbose: false,
strictSSL: false,
regex: /([A-Z]{1}[A-Z0-9]+\-[0-9]+)/g,
sprintField: '',
customFields: {},
},
slack: {
token: 'xoxb-Your-Token',
autoReconnect: true,
},
usermap: {},
};
module.exports = config;
32 changes: 0 additions & 32 deletions gulpfile.js

This file was deleted.

Loading

0 comments on commit 9785c7c

Please sign in to comment.