Skip to content

Commit

Permalink
[fix minor] A couple of small changes to merge in watch from @mmalecki
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Oct 1, 2011
1 parent d891990 commit 8c8f0e0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
1 change: 1 addition & 0 deletions bin/forever
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ var mappings = {
'v': 'verbose',
'verbose': 'verbose',
'w': 'watch',
'watch': 'watch',
'd': 'debug',
'debug': 'debug'
};
Expand Down
20 changes: 10 additions & 10 deletions lib/forever/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ var Monitor = exports.Monitor = function (script, options) {
this.childExists = false;
this.times = 0;


//
// Setup restart timing. These options control how quickly forever restarts
// a child process as well as when to kill a "spinning" process
Expand Down Expand Up @@ -385,13 +384,13 @@ Monitor.prototype.kill = function (forceStop) {
Monitor.prototype.watch = function () {
var self = this;

fs.readFile(
path.join(this.watchDirectory, '.foreverignore'), 'utf8',
function (err, data) {
if (err) {
return self.warn('Could not read .foreverignore file: ' + err.message);
}
Array.prototype.push.apply(self.watchIgnorePatterns, data.split('\n'));
fs.readFile(path.join(this.watchDirectory, '.foreverignore'), 'utf8', function (err, data) {
if (err) {
forever.log.warn('Could not read .foreverignore file.');
return forever.log.silly(err.message);
}

Array.prototype.push.apply(self.watchIgnorePatterns, data.split('\n'));
});

watch.watchTree(this.watchDirectory, function (f, curr, prev) {
Expand Down Expand Up @@ -420,12 +419,13 @@ Monitor.prototype._watchFilter = function (fileName) {
if (this.watchIgnoreDotFiles && path.basename(fileName)[0] == '.') {
return false;
}

for (var key in this.watchIgnorePatterns) {
if (minimatch(fileName, this.watchIgnorePatterns[key],
{matchBase: this.watchDirectory})) {
if (minimatch(fileName, this.watchIgnorePatterns[key], { matchBase: this.watchDirectory })) {
return false;
}
}

return true;
};

Expand Down

0 comments on commit 8c8f0e0

Please sign in to comment.