Browse files

[dist] Various small esoteric changes. Fixes #179

  • Loading branch information...
1 parent 061d14f commit dcbfc70c79e872b62c300a45b5392ae5b1d61b78 @indexzero indexzero committed Dec 2, 2011
Showing with 27 additions and 27 deletions.
  1. +1 −3 bin/forever
  2. +1 −1 examples/list-multiple.js
  3. +16 −8 lib/forever.js
  4. +7 −10 lib/forever/cli.js
  5. +1 −4 package.json
  6. +1 −1 test/helpers.js
View
4 bin/forever
@@ -1,6 +1,4 @@
#!/usr/bin/env node
-var forever = require('./../lib/forever');
-
-forever.cli.startCLI();
+require('./../lib/forever').cli.start();
View
2 examples/list-multiple.js
@@ -1,5 +1,5 @@
var path = require('path'),
- async = require('async'),
+ async = require('utile').async,
forever = require('../lib/forever');
function startServer (port, next) {
View
24 lib/forever.js
@@ -11,17 +11,16 @@ var fs = require('fs'),
events = require('events'),
exec = require('child_process').exec,
net = require('net'),
- async = require('async'),
- colors = require('colors'),
cliff = require('cliff'),
daemon = require('daemon'),
nconf = require('nconf'),
- mkdirp = require('mkdirp').mkdirp,
portfinder = require('portfinder'),
timespan = require('timespan'),
spawn = require('child_process').spawn,
psTree = require('ps-tree'),
utile = require('utile'),
+ mkdirp = utile.mkdirp,
+ async = utile.async,
winston = require('winston');
var forever = exports;
@@ -43,7 +42,7 @@ forever.log.cli();
//
forever.initialized = false;
forever.root = path.join(process.env.HOME || '/root', '.forever');
-forever.config = new nconf.stores.File({ file: path.join(forever.root, 'config.json') });
+forever.config = new nconf.File({ file: path.join(forever.root, 'config.json') });
forever.Forever = forever.Monitor = require('./forever/monitor').Monitor;
forever.cli = require('./forever/cli');
@@ -118,7 +117,7 @@ function getAllProcesses(callback) {
});
socket.on('data', function (msg) {
- data += msg.toString();
+ data += msg;
});
socket.on('close', function () {
@@ -127,9 +126,18 @@ function getAllProcesses(callback) {
monitors = JSON.parse(data);
}
catch (ex) {
- return next();
+ //
+ // Ignore errors
+ //
+ }
+
+ //
+ // Be a little lazier about loading results
+ //
+ if (monitors && monitors.monitors) {
+ results = results.concat(monitors.monitors);
}
- results.push.apply(results, monitors.monitors);
+
next();
});
@@ -185,7 +193,7 @@ forever.load = function (options) {
return;
}
- forever.config = new nconf.stores.File({ file: path.join(options.root, 'config.json') });
+ forever.config = new nconf.File({ file: path.join(options.root, 'config.json') });
//
// Try to load the forever `config.json` from
View
17 lib/forever/cli.js
@@ -91,7 +91,6 @@ var argvOptions = {
'plain': {boolean: true}
};
-app.use(flatiron.plugins.config);
app.config.argv(argvOptions).env();
var reserved = ['root', 'pidPath'];
@@ -171,7 +170,7 @@ function getOptions(file) {
// we've removed some before.
//
app.config.stores.argv.store = {};
- app.config.stores.argv.loadSync();
+ app.config.use('argv');
[
'pidFile', 'logFile', 'errFile', 'watch', 'minUptime', 'appendLog',
@@ -462,13 +461,11 @@ app.cmd(/(.*)/, cli.start = function (file) {
});
});
-cli.startCLI = function () {
- app.init(function () {
- if (app.config.get('help')) {
- return util.puts(help.join('\n'));
- }
-
- app.start();
- });
+cli.start = function () {
+ if (app.config.get('help')) {
+ return util.puts(help.join('\n'));
+ }
+
+ app.init(app.start);
};
View
5 package.json
@@ -22,16 +22,13 @@
"tools"
],
"dependencies": {
- "async": "0.1.x",
- "colors": "0.x.x",
"cliff": "0.x.x",
"clip": "0.x.x",
"dnode": "0.8.x",
"daemon": "0.3.x >=0.3.2",
"flatiron": "0.1.x",
"minimatch": "0.0.x",
- "mkdirp": "0.x.x",
- "nconf": "0.4.x",
+ "nconf": "0.5.x",
"optimist": "0.2.x",
"pkginfo": "0.x.x",
"portfinder": "0.x.x",
View
2 test/helpers.js
@@ -50,7 +50,7 @@ helpers.spawn = function (args, options) {
// doesn't wait for slave to start up after it's forked, it just quits)
//
setTimeout(function () {
- self.callback(exitCode, stdout, stderr);
+ self.callback(null, exitCode, stdout, stderr);
}, 200);
});
};

0 comments on commit dcbfc70

Please sign in to comment.