forked from jjasghar/hubot-welcome
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.js
35 lines (31 loc) · 1.04 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
// Generated by CoffeeScript 1.9.2
(function() {
var fs, path,
indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; };
fs = require('fs');
path = require('path');
module.exports = function(robot, scripts) {
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 != null) && indexOf.call(scripts, '*') < 0) {
if (indexOf.call(scripts, script) >= 0) {
results.push(robot.loadFile(scriptsPath, script));
} else {
results.push(void 0);
}
} else {
results.push(robot.loadFile(scriptsPath, script));
}
}
return results;
}
});
};
}).call(this);