blob: a2c8edf99da29ba5643101cdb1d992d0fc450363 (
plain)
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
44
45
46
47
48
49
50
51
52
53
54
55
|
var Q = require("q");
var _ = require("lodash");
var path = require("path");
var Book = require("./book");
var Plugin = require("./plugin");
module.exports = {
Book: Book,
commands: [
// Build command that simply build a book into an output folder
{
name: "build",
description: "build a book",
exec: function(args, kwargs) {
var input = args[0] || process.cwd();
var output = args[1] || path.join(input, "_book");
kwargs = _.defaults(kwargs || {}, {
format: "website"
});
var book = new Book(input, _.extend({}, {
'config': {
'output': output
},
'logLevel': Book.LOG_LEVELS[(kwargs.log || "info").toUpperCase()]
}));
return book.parse()
.then(function() {
return book.generate(kwargs.format);
});
}
},
// Install command that install plugins needed by a book
{
name: "install",
description: "install plugins dependencies",
exec: function(args, kwargs) {
var input = args[0] || process.cwd();
var book = new Book(input);
return book.config.load()
.then(function() {
return book.config.installPlugins({
log: true
});
});
}
}
]
};
|