diff options
author | Samy Pessé <samypesse@gmail.com> | 2014-04-09 08:17:37 +0200 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2014-04-09 08:17:37 +0200 |
commit | 1b432288f041baef2ebe54c96a7a86f547b14c67 (patch) | |
tree | 8856ef41c7f38e135d84c8f5f3e4363c91459569 /bin/build.js | |
parent | 2182baa2e9bf520943871c52340066cfdd28ba0b (diff) | |
parent | fa2f82d52f34b725483f0fd55be3cc9b04f7dc9b (diff) | |
download | gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.zip gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.tar.gz gitbook-1b432288f041baef2ebe54c96a7a86f547b14c67.tar.bz2 |
Merge branch 'optional-github' of https://github.com/mrpotes/gitbook into mrpotes-optional-github
Diffstat (limited to 'bin/build.js')
-rw-r--r-- | bin/build.js | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/bin/build.js b/bin/build.js index 4f7429a..0384b77 100644 --- a/bin/build.js +++ b/bin/build.js @@ -24,16 +24,19 @@ var buildFunc = function(dir, options) { return null; }) .then(function(repoID) { + var title = options.title; var githubID = options.github || repoID; - if(!githubID) { - throw new Error('Needs a githubID (username/repo). Either set repo origin to a github repo or use the -g flag'); - } - - var parts = githubID.split('/', 2); - var user = parts[0], repo = parts[1]; + if (!title && !githubID) { + throw new Error('Needs either a title or a githubID (username/repo).\n'+ + ' If using github, either set repo origin to a github repo or use the -g flag.\n'+ + ' For title, use the -t flag.'); + } else if (!title) { + var parts = githubID.split('/', 2); + var user = parts[0], repo = parts[1]; - var title = options.title || utils.titleCase(repo); + title = utils.titleCase(repo); + } return generate.folder( _.extend(options.options || {}, { @@ -111,4 +114,4 @@ var buildFiles = function(dir, outputFile, options, masterOptions) { module.exports = { folder: buildFunc, files: buildFiles -};
\ No newline at end of file +}; |