forked from Treterten/hackronym
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
31 lines (25 loc) · 672 Bytes
/
index.js
File metadata and controls
31 lines (25 loc) · 672 Bytes
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
var fs = require('fs');
var path = require('path');
module.exports = function(robot, scripts) {
'use strict';
var scriptsPath;
scriptsPath = path.resolve(__dirname, 'src');
return fs.exists(scriptsPath, function(exists) {
var i, len, ref, results, script;
if (exists) {
ref = fs.readdirSync(scriptsPath);
results = [];
for (i = 0, len = ref.length; i < len; i++) {
script = ref[i];
if (scripts && scripts.indexOf('*') < 0) {
if (scripts.indexOf(script) > -1) {
results.push(robot.loadFile(scriptsPath, script));
}
} else {
results.push(robot.loadFile(scriptsPath, script));
}
}
return results;
}
});
};