Permalink
Browse files

[bin, core] autoreload option

  • Loading branch information...
indutny committed Jun 18, 2011
1 parent aaf6764 commit d27e9cb476b24e41c00477b59c0cf63a82b9f147
Showing with 13 additions and 4 deletions.
  1. +4 −2 bin/bar
  2. +9 −2 lib/bar/core.js
View
@@ -1,9 +1,11 @@
#!/usr/bin/env node
var bar = require('../lib/bar'),
argv = require('optimist')
- .default('path', __dirname)
+ .default('path', './')
+ .default('autoreload', 'true')
.argv;
bar.create(argv.path, {
- nolog: argv.nolog
+ nolog: argv.nolog,
+ autoreload: argv.autoreload === 'true'
});
View
@@ -29,7 +29,8 @@ function Bar(dir, options) {
this.options = options = bar.utils.merge({
EventEmitter: require('eventemitter2').EventEmitter2,
log: null,
- nolog: false
+ nolog: false,
+ autoreload: true
}, options);
/**
@@ -64,7 +65,13 @@ function Bar(dir, options) {
/**
* File was updated/created
*/
- that.enter(curr === null ? Object.keys(f) : [f]);
+ if (curr === null) {
+ that.enter(Object.keys(f));
+ } else {
+ if (options.autoreload) {
+ that.enter([f]);
+ }
+ }
}
});

0 comments on commit d27e9cb

Please sign in to comment.