Skip to content

Commit

Permalink
Setup for web interface
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Dec 8, 2010
1 parent a86a8c2 commit a2cf31c
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 14 deletions.
3 changes: 2 additions & 1 deletion lib/node.io/index.js
Expand Up @@ -18,5 +18,6 @@ exports = module.exports = {
HttpProxy: request.HttpProxy,
start: processor.start,
startSlave: processor.startSlave,
cli: require('./cli').cli
cli: require('./cli').cli,
utils: require('./utils')
};
4 changes: 3 additions & 1 deletion lib/node.io/io.js
Expand Up @@ -446,7 +446,9 @@ Job.prototype.append = function (file, data, callback) {
*/
Job.prototype.waitForOutputStreamDrains = function (callback) {
var self = this;
this.status('Waiting on output stream(s) to drain..');
if (this.out_file) {
this.status('Waiting on output stream(s) to drain..');
}
var wait_for_drain = function () {
var keep_waiting = false;
for (var i in self.output_streams) {
Expand Down
43 changes: 42 additions & 1 deletion lib/node.io/utils.js
Expand Up @@ -325,4 +325,45 @@ exports.daemonize = function (arg, callback) {
start();
break;
}
}
}

/**
* Recursively and asyncronously find all files in a directory.
*
* `callback` receives an array of files.
*
* @param {String} path
* @param {Function} callback
* @api public
*/
exports.getFiles = function (root_path, callback) {
var files = [];
fs.readdir(root_path, function(err, dir_files) {
if (err) throw err;
var i = dir_files.length;
var check_complete = function () {
if (i === 0) {
callback(files);
}
};
check_complete();
dir_files.forEach(function (path) {
fs.stat(root_path + '/' + path, function (err, stat) {
if (err) throw err;
if (stat.isDirectory()) {
exports.getFiles(root_path + '/' + path, function (subdir_files) {
subdir_files.forEach(function (file) {
files.push(path + '/' + file);
});
i--;
check_complete();
});
} else {
files.push(path);
i--;
check_complete();
}
});
});
});
};
24 changes: 13 additions & 11 deletions package.json
Expand Up @@ -6,15 +6,15 @@
"author" : "Chris O'Hara <cohara87@gmail.com>",
"main" : "./lib/node.io",
"directories" : { "lib" : "./lib/node.io" },
"bugs":
{ "mail": "",
"web": "http://github.com/chriso/node.io/issues"
},
"bugs": {
"mail": "cohara87@gmail.com",
"web": "http://github.com/chriso/node.io/issues"
},
"repository": {
"type": "git",
"url": "http://github.com/chriso/node.io.git"
},
"engines": { "node" : ">=0.2.5" },
"engines": { "node": ">=0.2.5" },
"dependencies": {
"soupselect": ">= 0.2.0",
"validator": ">= 0.1.1",
Expand All @@ -23,10 +23,12 @@
"daemon": ">= 0.1.0"
},
"scripts": { "test": "expresso test" },
"bin": { "node.io": "./bin/node.io" },
"licenses":
[ { "type": "MIT",
"url": "http://github.com/chriso/node.io/raw/master/LICENSE"
}
]
"bin": {
"node.io": "./bin/node.io",
"node.io-web": "./bin/node.io-web"
},
"licenses": [{
"type": "MIT",
"url": "http://github.com/chriso/node.io/raw/master/LICENSE"
}]
}

0 comments on commit a2cf31c

Please sign in to comment.