summaryrefslogtreecommitdiffstats
path: root/lib/index.js
blob: 8b7a3908a6d6f40f8ca68dcf649d2d31a1fe59a2 (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
var Q = require("q");
var _ = require("lodash");
var path = require("path");

var Book = require("./book");

module.exports = {
	Book: Book,

	commands: [
		{
			name: "build",
			description: "Build a book",
			exec: function(args, kwargs) {
				var input = args[0] || process.cwd();
				var output = args[1] || path.join(input, "_book");

				var book = new Book(input, _.extend({}, {
					'output': output
				}));

				return book.parse()
				.then(function() {
					return book.generate();
				});
			}
		}
	]
};