diff options
author | Samy Pessé <samypesse@gmail.com> | 2016-01-22 21:04:36 +0100 |
---|---|---|
committer | Samy Pessé <samypesse@gmail.com> | 2016-01-22 21:04:36 +0100 |
commit | 877f2e477b010f9f37a9044606f110a90f077680 (patch) | |
tree | 5cd61cf3b00ba10dc6110535ed9fdf67d8baba72 /lib/utils/watch.js | |
parent | c8e2fc0e57d223c01a51d6ee186fc1662cd74d13 (diff) | |
download | gitbook-877f2e477b010f9f37a9044606f110a90f077680.zip gitbook-877f2e477b010f9f37a9044606f110a90f077680.tar.gz gitbook-877f2e477b010f9f37a9044606f110a90f077680.tar.bz2 |
Start rewrite
Diffstat (limited to 'lib/utils/watch.js')
-rw-r--r-- | lib/utils/watch.js | 40 |
1 files changed, 0 insertions, 40 deletions
diff --git a/lib/utils/watch.js b/lib/utils/watch.js deleted file mode 100644 index 4d1a752..0000000 --- a/lib/utils/watch.js +++ /dev/null @@ -1,40 +0,0 @@ -var Q = require("q"); -var _ = require("lodash"); -var path = require("path"); -var chokidar = require("chokidar"); - -var parsers = require("gitbook-parsers"); - -function watch(dir) { - var d = Q.defer(); - dir = path.resolve(dir); - - var toWatch = [ - "book.json", "book.js" - ]; - - _.each(parsers.extensions, function(ext) { - toWatch.push("**/*"+ext); - }); - - var watcher = chokidar.watch(toWatch, { - cwd: dir, - ignored: "_book/**", - ignoreInitial: true - }); - - watcher.once("all", function(e, filepath) { - watcher.close(); - - d.resolve(filepath); - }); - watcher.once("error", function(err) { - watcher.close(); - - d.reject(err); - }); - - return d.promise; -} - -module.exports = watch; |