Permalink
Browse files

[dist] Update for JSHint

  • Loading branch information...
1 parent 4e27e3d commit f7575f945b464c59df93f6c69df42bae27ae1636 @indexzero committed Oct 9, 2011
Showing with 20 additions and 17 deletions.
  1. +18 −15 lib/forever/monitor.js
  2. +1 −1 lib/forever/service/index.js
  3. +1 −1 lib/forever/service/service.js
View
@@ -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
@@ -149,7 +149,7 @@ Monitor.prototype.start = function (restart) {
});
return this;
}
-
+
child = this.trySpawn();
if (!child) {
process.nextTick(function () {
@@ -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 {
@@ -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
@@ -422,7 +425,7 @@ Monitor.prototype.watch = function () {
self.info('restaring script because ' + f + ' changed');
self.restart();
}
- };
+ }
});
};
@@ -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;
};
@@ -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`.
@@ -468,7 +471,7 @@ Monitor.prototype._getEnv = function () {
addKey(key, process.env);
}
});
-
+
Object.keys(this.env).forEach(function (key) {
addKey(key, self.env);
});
@@ -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);
- })
+ });
});
@@ -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,

0 comments on commit f7575f9

Please sign in to comment.