summaryrefslogtreecommitdiffstats
path: root/lib/generate
diff options
context:
space:
mode:
authorPaul Dixon <paul.dixon@durham.ac.uk>2014-04-04 14:55:08 +0100
committerPaul Dixon <paul.dixon@durham.ac.uk>2014-04-04 14:55:08 +0100
commitb1314273bb44648547adbd1e2b7b724903ac6020 (patch)
treeaffad469a82e9668ffa5819ce26af9ca6ac0efd0 /lib/generate
parentcb9a0b82ba0478b9a5b37de6f920edff474312e1 (diff)
downloadgitbook-b1314273bb44648547adbd1e2b7b724903ac6020.zip
gitbook-b1314273bb44648547adbd1e2b7b724903ac6020.tar.gz
gitbook-b1314273bb44648547adbd1e2b7b724903ac6020.tar.bz2
Adding config option for github host
- this config option allows the github host url to be set to something other than github.com, mainly so that github enterprise users can change the url to their private host but will also work with bitbucket
Diffstat (limited to 'lib/generate')
-rw-r--r--lib/generate/index.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index 315ceda..ee5ffc4 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -11,16 +11,18 @@ var generate = function(root, output, options) {
var files, summary, navigation, tpl;
options = _.defaults(options || {}, {
- // Book title, description
+ // Book title, keyword, description
title: null,
description: "Book generated using GitBook",
// Origin github repository id
- github: null
+ github: null,
+ githubHost: 'https://github.com/'
});
- if (!options.github || !options.title) return Q.reject(new Error("Need options.github and options.title"));
-
+ if (!options.github || !options.title) {
+ return Q.reject(new Error("Need options.github and options.title"));
+ }
// Clean output folder
return fs.remove(output)
@@ -39,7 +41,7 @@ var generate = function(root, output, options) {
files = _files;
if (!_.contains(files, "SUMMARY.md") || !_.contains(files, "README.md")) {
- return Q.reject(new Error("Invalid gitbook repository: need SUMMARY.md and README.md"));
+ return Q.reject(new Error("Invalid gitbook repository, need SUMMARY.md and README.md"));
}
})
@@ -65,7 +67,8 @@ var generate = function(root, output, options) {
githubAuthor: options.github.split("/")[0],
githubId: options.github,
-
+ githubHost: options.githubHost,
+
summary: summary,
allNavigation: navigation
}