diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-08-09 16:17:27 -0700 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-08-11 07:36:49 -0700 |
commit | fe95c361be27e00d45b999d3b0861abd0075be66 (patch) | |
tree | 2ac38a9c2e9374eca4e83631fe3b7ab83a26d527 /lib/generate | |
parent | 7e785465161ff3ca43c4e37c9caf1d94d5078bd2 (diff) | |
download | gitbook-fe95c361be27e00d45b999d3b0861abd0075be66.zip gitbook-fe95c361be27e00d45b999d3b0861abd0075be66.tar.gz gitbook-fe95c361be27e00d45b999d3b0861abd0075be66.tar.bz2 |
Fix options parsing
Diffstat (limited to 'lib/generate')
-rw-r--r-- | lib/generate/config.js | 3 | ||||
-rw-r--r-- | lib/generate/index.js | 13 |
2 files changed, 5 insertions, 11 deletions
diff --git a/lib/generate/config.js b/lib/generate/config.js index a250a3c..ad9c697 100644 --- a/lib/generate/config.js +++ b/lib/generate/config.js @@ -13,6 +13,9 @@ var CONFIG = { // It's not advised this option in the book.json "generator": "site", + // Configuration file to use + "configFile": "book", + // Book title and description (defaults are extracted from the README) "title": null, "description": null, diff --git a/lib/generate/index.js b/lib/generate/index.js index c9d6e5c..c71e0a6 100644 --- a/lib/generate/index.js +++ b/lib/generate/index.js @@ -49,14 +49,7 @@ var loadGenerator = function(options) { var generate = function(options) { // Set defaults to options - options = _.defaults(options || {}, { - // Config file (relative to input) - "configFile": "book", - - // Output generator - "generator": "site" - }); - //options = _.merge(options || {}, defaultConfig, _.defaults); + options = defaultConfig.defaults(options); // Validate options if (!options.input) { @@ -71,14 +64,12 @@ var generate = function(options) { try { var _config = require(path.resolve(options.input, options.configFile)); - _.extend(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins')); + options = _.merge(options, _.omit(_config, 'input', 'configFile', 'defaultsPlugins')); } catch(err) { // No config file: not a big deal return Q(); } - - options = defaultConfig.defaults(options); }) // Read readme |