summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2016-02-21 11:28:55 +0100
committerSamy Pessé <samypesse@gmail.com>2016-02-21 11:28:55 +0100
commitca1313e891f7cfbdffaf6a47bb75a8bc1d77c1a4 (patch)
treec121c0ead1b515145e5e563ce1c48ff293b59a6f /lib
parent8df18746face0bf43d18540d3de5ac0cdd795549 (diff)
downloadgitbook-ca1313e891f7cfbdffaf6a47bb75a8bc1d77c1a4.zip
gitbook-ca1313e891f7cfbdffaf6a47bb75a8bc1d77c1a4.tar.gz
gitbook-ca1313e891f7cfbdffaf6a47bb75a8bc1d77c1a4.tar.bz2
Extend configuration with infos from readme
Diffstat (limited to 'lib')
-rw-r--r--lib/book.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/book.js b/lib/book.js
index cbb85c0..c81d255 100644
--- a/lib/book.js
+++ b/lib/book.js
@@ -196,9 +196,13 @@ Book.prototype.parse = function() {
// Parse the readme
.then(that.readme.load)
.then(function() {
- if (that.readme.exists()) return;
+ if (!that.readme.exists()) {
+ throw new error.FileNotFoundError({ filename: 'README' });
+ }
- throw new error.FileNotFoundError({ filename: 'README' });
+ // Default configuration to infos extracted from readme
+ if (!that.config.get('title')) that.config.set('title', that.readme.title);
+ if (!that.config.get('description')) that.config.set('description', that.readme.description);
})
// Parse the summary