Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

merged in changes from upstream repo

  • Loading branch information...
commit 0ed2a1629635f5d0f281305726d213ff279544df 2 parents 9ce652b + c33de82
@codelotus authored
View
2  .gitignore
@@ -1,2 +0,0 @@
-Makefile
-build
View
19 Makefile.src
@@ -1,19 +0,0 @@
-
-all: node-supervisor
-
-node-supervisor:
- @! test -d build && mkdir build || true
- @gcc -DNODE_BIN="\"@NODE_BIN@\"" -o build/node-supervisor src/node-supervisor.c
- @echo "built"
-
-install:
- @! test -d /usr/local/lib/node-supervisor && mkdir /usr/local/lib/node-supervisor || true
- @cp lib/*.js /usr/local/lib/node-supervisor/
- @cp build/node-supervisor /usr/local/bin/
- @echo "installed"
-
-clean:
- @test -d build && rm -r build || true
- @test -d /usr/local/lib/node-supervisor/ && rm -r /usr/local/lib/node-supervisor/ || true
- @test -f /usr/local/bin/node-supervisor && rm /usr/local/bin/node-supervisor || true
- @echo "cleaned"
View
12 README.md
@@ -6,17 +6,19 @@ behavior, without worrying about memory leaks and making sure you
clean up all the inter-module references, and without a whole new
`require` system.
-## Easy install
+## Simple Install
Install npm, and then do this:
npm install supervisor
-## Fancy install
+You don't even need to download or fork this repo at all.
-Get the code.
+## Fancy Install
- ./configure && make && sudo make install
+Get this code, install npm, and then do this:
+
+ npm link .
## todo
@@ -37,5 +39,3 @@ it out if told to supervise the same program.
6. It'd be pretty cool if this program could be run just like
doing `node blah.js`, but could somehow "know" which files had
been loaded, and restart whenever a touched file changes.
-7. Remove the C stuff. Just do it all in js, and accept that
-shebang won't work in OS X.
View
3  configure
@@ -1,3 +0,0 @@
-#!/bin/sh
-
-sed "s|@NODE_BIN@|$(which node)|g" < Makefile.src > Makefile
View
19 lib/cli-wrapper.js
@@ -1,13 +1,10 @@
-var path = require("path"),
- args = process.argv.slice(0);
+#!/usr/bin/env node
+var path = require("path")
+ , args = process.argv.slice(1)
-for (
- var arg = args.shift();
- arg !== __filename && path.basename(arg) !== "node-supervisor"
- && path.basename(arg) !== "supervisor.js";
- arg = args.shift()
-) {
- require("sys").debug("-->"+arg);
-}
+do var arg = args.shift()
+while ( arg !== __filename && path.basename(arg) !== "node-supervisor"
+ && path.basename(arg) !== "supervisor.js"
+ )
-require("./supervisor").run(args);
+require("./supervisor").run(args)
View
11 lib/supervisor.js
@@ -36,8 +36,7 @@ function run (args) {
sys.debug("WatchItem: " + watchItem);
findAllJsFiles(watchItem, watchGivenFile);
});
- }
- else {
+ } else {
sys.error("No watch dir or file specified.");
throw new Error("No watch dir or file specified");
}
@@ -104,8 +103,7 @@ var findAllJsFiles = function(path, callback) {
fs.stat(path, function(err, stats){
if(err) {
sys.puts('Error retrieving stats for file: ' + path);
- }
- else {
+ } else {
if(stats.isDirectory()) {
fs.readdir(path, function(err, fileNames) {
if(err) {
@@ -117,9 +115,8 @@ var findAllJsFiles = function(path, callback) {
});
}
});
- }
- else {
- if(path.match(/.*\.js$/)) {
+ } else {
+ if(path.match(/.*\.(js|node)/)) {
callback(path);
}
}
View
10 package.json
@@ -1,14 +1,10 @@
{ "name" : "supervisor"
-, "version" : "0.0.3"
+, "version" : "0.0.4"
, "description" : "A supervisor program for running nodejs programs"
, "author" : "Isaac Z. Schlueter <i@izs.me>"
-, "scripts" :
- { "preinstall" : "./configure"
- , "install" : "make"
- , "uninstall" : "make clean"
- }
+, "contributors" : [ "Brian Ehmann <behmann@gmail.com>" ]
, "main" : "lib/supervisor"
-, "bin" : { "node-supervisor" : "./build/node-supervisor" }
+, "bin" : { "node-supervisor" : "lib/cli-wrapper.js" }
, "engines" : { "node" : ">=0.1.90" }
, "directories" : { "lib" : "lib" }
}
View
16 src/node-supervisor.c
@@ -1,16 +0,0 @@
-#define NODE_SUPERVISOR "/usr/local/lib/node-supervisor/cli-wrapper.js"
-#include <unistd.h>
-#include <stdlib.h>
-int main (int argc, char** argv) {
- char** argv2 = malloc(sizeof(char*) * (2 + argc));
- int i;
- argv2[0] = "node";
- argv2[1] = NODE_SUPERVISOR;
- for (i = 0; i <= argc; i++) {
- argv2[i+2] = argv[i];
- }
- return execv(
- NODE_BIN,
- argv2
- );
-}
Please sign in to comment.
Something went wrong with that request. Please try again.