From 7b9b4bed1eb4ac268b13c9f09c6d2aa42e3397df Mon Sep 17 00:00:00 2001 From: indexzero Date: Sun, 13 Feb 2011 21:21:48 -0500 Subject: [PATCH] [docs] Updated docs from docco --- docs/forever.html | 14 ++++++++------ docs/forever/monitor.html | 8 +++++++- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/docs/forever.html b/docs/forever.html index 62120585..a9e7c2d3 100644 --- a/docs/forever.html +++ b/docs/forever.html @@ -8,17 +8,18 @@ require.paths.unshift(__dirname); -var sys = require('sys'), - fs = require('fs'), +var fs = require('fs'), colors = require('colors'), path = require('path'), events = require('events'), exec = require('child_process').exec, + timespan = require('timespan'), daemon = require('daemon'); var forever = exports, config;

Export Components / Settings

Export version and important Prototypes from lib/forever/*

forever.version = [0, 4, 0];
+forever.path    = path.join('/tmp', 'forever');
 forever.Forever = forever.Monitor = require('forever/monitor').Monitor; 

function load (options, [callback])

@options {Object} Options to load into the forever module

@@ -28,7 +29,7 @@

[@callback] {function} Continuation to pass control back to

Initializes configuration for forever module

forever.load = function (options, callback) {
   var emitter = new events.EventEmitter();
   options         = options || {};
-  options.root    = options.root || path.join('/tmp', 'forever'),
+  options.root    = options.root || forever.path,
   options.pidPath = options.pidPath || path.join(options.root, 'pids');
   forever.config  = config = options;
   

Create the two directories, ignoring errors

  fs.mkdir(config.root, 0755, function (err) { 
@@ -63,17 +64,17 @@ 

@script {string} Location of the script to run.

@options {Object} Configuration for forever instance.

Starts a script with forever

forever.start = function (script, options) {
-  return new Forever(script, options).start();
+  return new forever.Monitor(script, options).start();
 };

function startDaemon (script, options)

@script {string} Location of the script to run.

@options {Object} Configuration for forever instance.

-

Starts a script with forever as a daemon

forever.startDaemon = function (file, options) {
+

Starts a script with forever as a daemon

forever.startDaemon = function (script, options) {
   options.logFile = path.join(config.root, options.logFile || 'forever.log');
   options.pidFile = path.join(config.pidPath, options.pidFile);
-  var runner = new Forever(file, options);
+  var runner = new forever.Monitor(script, options);
 
   daemon.daemonize(options.logFile, options.pidFile, function (err, pid) {
     if (err) return runner.emit('error', err);
@@ -283,6 +284,7 @@ 

@padding {string} Padding to add to the formatted output

.concat(proc.options.map(function (opt) { return opt.green })) .concat([padding + '[' + proc.pid + ',', proc.foreverPid + ']']) .concat(proc.logFile.magenta) + .concat(timespan.fromDates(new Date(proc.ctime), new Date()).toString().yellow) .join(' '); };

function getAllProcess ([findDead])

diff --git a/docs/forever/monitor.html b/docs/forever/monitor.html index bae28634..f2f4a6ae 100644 --- a/docs/forever/monitor.html +++ b/docs/forever/monitor.html @@ -6,7 +6,11 @@ * */ -var spawn = require('child_process').spawn, +var sys = require('sys'), + fs = require('fs'), + path = require('path'), + events = require('events'), + spawn = require('child_process').spawn, forever = require('forever');

function Monitor (script, options)

@script {string} Location of the target script to run.

@@ -64,6 +68,7 @@

@restart {boolean} Value indicating whether this is a restart.

return this; } + this.ctime = Date.now(); this.child = child; this.running = true; self.emit(restart ? 'restart' : 'start', self); @@ -128,6 +133,7 @@

@restart {boolean} Value indicating whether this is a restart.

} var childData = { + ctime: this.ctime, pid: this.child.pid, foreverPid: process.pid, logFile: this.logFile,