-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcli.js
36 lines (28 loc) · 772 Bytes
/
cli.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
#!/usr/bin/env node
var ui = require("./lib/ui");
function exit (msg) {
ui.log(ui.color.red("Error") + ": " + msg);
process.exit(1);
}
function main (config) {
if (
!config.files.length
) exit("At least one testfile is required. Hint: you can specify many!");
var path = [];
for (
var part, root = config.cwd.split("/");
part != "src" && root.length;
part = root.pop(), path.unshift(part)
);
config.root = root.join("/");
config.path = path.join("/");
if (
!config.root
) exit("You must be inside the YUI src directory.");
require("./server").boot(config);
}
main({
port : parseInt(process.env.PORT) || 8000,
files : process.argv.slice(2),
cwd : process.cwd()
});