summaryrefslogtreecommitdiffstats
path: root/lib/generate/index.js
diff options
context:
space:
mode:
authorSamy Pessé <samypesse@gmail.com>2014-04-28 20:16:30 +0200
committerSamy Pessé <samypesse@gmail.com>2014-04-28 20:16:30 +0200
commit5f1bfc02805e074ab47bc8966410cf8042363c48 (patch)
tree74072e8dbb2963e3697846dbc59efbb214f76d6b /lib/generate/index.js
parentb715901f9203daacf705ce4e9db47b3d75980996 (diff)
downloadgitbook-5f1bfc02805e074ab47bc8966410cf8042363c48.zip
gitbook-5f1bfc02805e074ab47bc8966410cf8042363c48.tar.gz
gitbook-5f1bfc02805e074ab47bc8966410cf8042363c48.tar.bz2
Fix #163: Move logic of git infos extraction to lib
Diffstat (limited to 'lib/generate/index.js')
-rw-r--r--lib/generate/index.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index 0c3e693..0e7eb6c 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -63,6 +63,20 @@ var generate = function(options) {
// Clean output folder
return fs.remove(options.output)
+ // Get repo's URL
+ .then(function() {
+ return parse.git.url(options.input)
+ .then(function(_url) {
+ // Get ID of repo
+ return parse.git.githubID(_url);
+ }, function(err) {
+ return null;
+ })
+ .then(function(repoId) {
+ options.github = options.github || repoId;
+ });
+ })
+
.then(function() {
return fs.mkdirp(options.output);
})