Skip to content

Commit

Permalink
[dist] Update for JSHint
Browse files Browse the repository at this point in the history
  • Loading branch information
indexzero committed Oct 9, 2011
1 parent 4e27e3d commit f7575f9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 17 deletions.
33 changes: 18 additions & 15 deletions lib/forever/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var Monitor = exports.Monitor = function (script, options) {
this.env = options.env || {};
this.hideEnv = options.hideEnv || [];
this._hideEnv = {};

//
// Create a simple mapping of `this.hideEnv` to an easily indexable
// object
Expand Down Expand Up @@ -149,7 +149,7 @@ Monitor.prototype.start = function (restart) {
});
return this;
}

child = this.trySpawn();
if (!child) {
process.nextTick(function () {
Expand Down Expand Up @@ -374,14 +374,17 @@ Monitor.prototype.kill = function (forceStop) {
if (forceStop) {
this.forceStop = true;
}

if (this.killTree) {
psTree(this.child.pid, function (err, children) {
var pids = children.map(function (p) { return p.PID })
pids.shift(self.child.pid)
var pids = children.map(function (p) {
return p.PID;
});

pids.shift(self.child.pid);
spawn('kill', ['-9'].concat(pids)).on('exit', function () {
self.emit('stop', self.childData);
})
self.emit('stop', self.childData);
});
});
}
else {
Expand All @@ -406,12 +409,12 @@ Monitor.prototype.watch = function () {
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) {
if (!(curr == null && prev == null && typeof f == 'object')) {
if (!(curr === null && prev === null && typeof f === 'object')) {
//
// `curr` == null && `prev` == null && typeof f == "object" when watch
// finishes walking the tree to add listeners. We don't need to know
Expand All @@ -422,7 +425,7 @@ Monitor.prototype.watch = function () {
self.info('restaring script because ' + f + ' changed');
self.restart();
}
};
}
});
};

Expand All @@ -433,16 +436,16 @@ Monitor.prototype.watch = function () {
// is pretty messed up).
//
Monitor.prototype._watchFilter = function (fileName) {
if (this.watchIgnoreDotFiles && path.basename(fileName)[0] == '.') {
if (this.watchIgnoreDotFiles && path.basename(fileName)[0] === '.') {
return false;
}

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

return true;
};

Expand All @@ -458,7 +461,7 @@ Monitor.prototype._getEnv = function () {
function addKey(key, source) {
merged[key] = source[key];
}

//
// Mixin the key:value pairs from `process.env` and the custom
// environment variables in `this.env`.
Expand All @@ -468,7 +471,7 @@ Monitor.prototype._getEnv = function () {
addKey(key, process.env);
}
});

Object.keys(this.env).forEach(function (key) {
addKey(key, self.env);
});
Expand Down
2 changes: 1 addition & 1 deletion lib/forever/service/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ fs.readdirSync(path.join(__dirname, 'adapters')).forEach(function (file) {
file = file.replace(/\.js/, '');
service.adapters.__defineGetter__(file, function () {
return require(__dirname + '/adapters/' + file);
})
});
});
2 changes: 1 addition & 1 deletion lib/forever/service/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var fs = require('fs'),
// options
// directories {log, pid, conf, run, local}
var Service = module.exports = function Service(options) {
EventEmitter2.call(this);
events.EventEmitter.call(this);
options = options || {};

var self = this,
Expand Down

0 comments on commit f7575f9

Please sign in to comment.