forked from browserify/wzrd.in
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatuses.js
More file actions
43 lines (38 loc) · 857 Bytes
/
statuses.js
File metadata and controls
43 lines (38 loc) · 857 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
32
33
34
35
36
37
38
39
40
41
42
43
var stringifyError = require('./stringify-error');
module.exports = function (app, bundle) {
//
// Build statuses
//
app.get('/status/:module', status(bundle));
};
function status(bundle) {
return function (req, res) {
var t = req.params.module.split('@'),
module = t.shift(),
semver,
subfile = module.split('/');
if (t.length) {
semver = t.shift();
}
else {
semver = 'latest';
}
if (subfile.length > 1) {
module = subfile.shift();
subfile = subfile.join('/');
}
bundle.status(module, semver, function (err, sts) {
if (err) {
return res.json(500, {
ok: false,
message: err.message,
hints: stringifyError.goodbye
});
}
res.json({
module: module,
builds: sts
});
});
};
}