summaryrefslogtreecommitdiffstats
path: root/lib/generate/index.js
diff options
context:
space:
mode:
authorAaron O'Mullan <aaron.omullan@friendco.de>2014-03-31 15:24:38 -0700
committerAaron O'Mullan <aaron.omullan@friendco.de>2014-03-31 15:24:38 -0700
commit36b961c5390eb6c5829b22bc143634a150a5eb38 (patch)
tree6e59ead7e198856a1710a5ceae25200334604e3c /lib/generate/index.js
parente9e94a7344bf25b4c2aa6eb9cb2ce5d93dda583b (diff)
downloadgitbook-36b961c5390eb6c5829b22bc143634a150a5eb38.zip
gitbook-36b961c5390eb6c5829b22bc143634a150a5eb38.tar.gz
gitbook-36b961c5390eb6c5829b22bc143634a150a5eb38.tar.bz2
Clean output folder before generating
Diffstat (limited to 'lib/generate/index.js')
-rw-r--r--lib/generate/index.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/generate/index.js b/lib/generate/index.js
index 73d1079..14168fd 100644
--- a/lib/generate/index.js
+++ b/lib/generate/index.js
@@ -19,10 +19,16 @@ var generate = function(root, output, options) {
if (!options.github || !options.title) return Q.reject(new Error("Need options.github and optiosn.title"));
+
+ // Clean output folder
+ return fs.remove(output)
+
// List all files in the repository
- return Q.nfcall(glob, "**/*", {
- cwd: root,
- mark: true
+ .then(function() {
+ return Q.nfcall(glob, "**/*", {
+ cwd: root,
+ mark: true
+ });
})
// Check repository is valid