Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding watching capabilities also for vendors. This is specially usef…

…ul if you have two applications, one inside another, but both being maintained individually. Doesn't matter which of them both changes, the dependent will always recompile again.
  • Loading branch information...
commit 6095e67d90895a5b4bef7deb356d8deb915b49ea 1 parent 1514773
@arboleya authored
Showing with 18 additions and 3 deletions.
  1. +11 −3 lib/toaster.js
  2. +7 −0 src/toaster/core/builder.coffee
View
14 lib/toaster.js
@@ -841,16 +841,24 @@ var toaster = exports.toaster = {};
};
Builder.prototype.watch = function() {
- var src, watcher, _i, _len, _ref1, _results;
+ var src, temp, vendor, watcher, _i, _j, _len, _len1, _ref1, _ref2, _results;
this.watchers = [];
_ref1 = this.config.src_folders;
- _results = [];
for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
src = _ref1[_i];
this.watchers.push((watcher = fsu.watch(src.path, /.coffee$/m)));
watcher.on('create', FnUtil.proxy(this.on_fs_change, src, 'create'));
watcher.on('change', FnUtil.proxy(this.on_fs_change, src, 'change'));
- _results.push(watcher.on('delete', FnUtil.proxy(this.on_fs_change, src, 'delete')));
+ watcher.on('delete', FnUtil.proxy(this.on_fs_change, src, 'delete'));
+ }
+ _ref2 = this.vendors;
+ _results = [];
+ for (_j = 0, _len1 = _ref2.length; _j < _len1; _j++) {
+ vendor = _ref2[_j];
+ temp = fsu.watch(vendor);
+ temp.on('create', FnUtil.proxy(this.on_fs_change, src, 'create'));
+ temp.on('change', FnUtil.proxy(this.on_fs_change, src, 'change'));
+ _results.push(temp.on('delete', FnUtil.proxy(this.on_fs_change, src, 'delete')));
}
return _results;
};
View
7 src/toaster/core/builder.coffee
@@ -156,6 +156,13 @@ class Builder
watcher.on 'change', (FnUtil.proxy @on_fs_change, src, 'change')
watcher.on 'delete', (FnUtil.proxy @on_fs_change, src, 'delete')
+ # watching vendors for changes
+ for vendor in @vendors
+ temp = fsu.watch vendor
+ temp.on 'create', (FnUtil.proxy @on_fs_change, src, 'create')
+ temp.on 'change', (FnUtil.proxy @on_fs_change, src, 'change')
+ temp.on 'delete', (FnUtil.proxy @on_fs_change, src, 'delete')
+
on_fs_change:(src, ev, f)=>
# skip all folder creation
return if f.type == "dir" and ev == "create"
Please sign in to comment.
Something went wrong with that request. Please try again.