summaryrefslogtreecommitdiffstats
path: root/lib/generate/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/generate/index.js')
-rw-r--r--lib/generate/index.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index 0e7eb6c..898e71f 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -31,6 +31,9 @@ var generate = function(options) {
input: null,
output: null,
+ // Config file (relative to input)
+ configFile: "book.json",
+
// Output generator
generator: "site",
@@ -63,6 +66,21 @@ var generate = function(options) {
// Clean output folder
return fs.remove(options.output)
+ // Read config file
+ .then(function() {
+ return fs.readFile(path.resolve(options.input, options.configFile))
+ .then(function(_config) {
+ // Extend current config
+ _config = JSON.parse(_config);
+ _config = _.omit(_config, 'input', 'configFile');
+
+ _.extend(options, _config);
+ }, function() {
+ // No config file: not a big deal
+ return Q();
+ })
+ })
+
// Get repo's URL
.then(function() {
return parse.git.url(options.input)