1 | path = require 'path'
|
2 |
|
3 | phabs_available_features = [
|
4 | 'events',
|
5 | 'api',
|
6 | 'commands',
|
7 | 'templates',
|
8 | 'admin',
|
9 | 'feeds',
|
10 | 'hear'
|
11 | ]
|
12 |
|
13 | phabs_features = if process.env.PHABS_ENABLED_FEATURES?
|
14 | enabled = process.env.PHABS_ENABLED_FEATURES.split(',')
|
15 | phabs_available_features.reduce (a, f) ->
|
16 | a.push f if f in enabled
|
17 | a
|
18 | , [ ]
|
19 | else if process.env.PHABS_DISABLED_FEATURES?
|
20 | disabled = process.env.PHABS_DISABLED_FEATURES.split(',')
|
21 | phabs_available_features.reduce (a, f) ->
|
22 | a.push f if f not in disabled
|
23 | a
|
24 | , [ ]
|
25 | else
|
26 | phabs_available_features
|
27 |
|
28 | module.exports = (robot) ->
|
29 | for feature in phabs_features
|
30 | robot.logger.debug "Loading phabs_#{feature}"
|
31 | robot.loadFile(path.resolve(__dirname, 'scripts'), "phabs_#{feature}.coffee")
|