-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.js
63 lines (53 loc) · 1.54 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*!
* assemblebot <https://github.com/assemble/assemblebot>
*
* Copyright (c) 2015, Brian Woodward.
* Licensed under the MIT License.
*/
'use strict';
var GithubBot = require('githubbot');
var handlers = require('./lib/handlers');
var utils = require('./lib/utils');
/**
* Main class for creating a new AssembleBot instance. This bot extends [GithubBot][githubbot]
* and creates an instance of [assemble-core][] that can be used to render response templates.
*
* ```js
* var bot = new AssembleBot({GITHUB_TOKEN: 'xxxxxxxxxxxxxxx'});
* ```
*
* @param {Object} `options` Options to use to configure the bot.
* @param {String} `options.GITHUB_TOKEN` Personal github token the bot uses to post to github issues.
* @api public
*/
function AssembleBot(options) {
if (!(this instanceof AssembleBot)) {
return new AssembleBot(options);
}
GithubBot.call(this, options);
this.initAssemble();
this.use(handlers(this.options));
}
/**
* Extend `GithubBot`
*/
GithubBot.extend(AssembleBot);
/**
* Create an instance of [assemble-core] with some configured defaults:
*
* - uses [assemble-loader]
* - uses [engine-handlebars] for ".hbs" files.
* - uses [handlebars-helpers]
* - uses [helper-issue]
*/
AssembleBot.prototype.initAssemble = function() {
this.define('assemble', new utils.Assemble());
this.assemble.use(utils.loader());
this.assemble.engine('hbs', utils.engine);
this.assemble.helpers(utils.helpers());
this.assemble.helper('issue', utils.issue);
};
/**
* Exposes `AssembleBot`
*/
module.exports = AssembleBot;