UNPKG

763 BJavaScriptView Raw
1// Generated by CoffeeScript 1.6.3
2var colors, hound, sep;
3
4hound = require('hound');
5
6colors = require('colors');
7
8sep = require('path').sep;
9
10module.exports.watcher = function(opts) {
11 var emitter, error, watchdir;
12 if (!((opts.path != null) && (opts.handler != null))) {
13 return;
14 }
15 watchdir = process.cwd() + sep + opts.path;
16 try {
17 emitter = hound.watch(watchdir);
18 emitter.on('change', opts.handler.change);
19 return console.log('ipso:' + (" watching directory: ." + sep + opts.path).grey);
20 } catch (_error) {
21 error = _error;
22 if (error.errno === 34) {
23 return console.log('ipso:' + (" expected directory: ." + sep + opts.path).red);
24 } else {
25 return console.log('ipso:' + (" exception " + error).red);
26 }
27 }
28};