Permalink
Browse files

Setup for web interface

  • Loading branch information...
1 parent a86a8c2 commit a2cf31c6a6ed0201e45a80b51c9366388ac3c9bc @chriso chriso committed Dec 8, 2010
Showing with 60 additions and 14 deletions.
  1. +2 −1 lib/node.io/index.js
  2. +3 −1 lib/node.io/io.js
  3. +42 −1 lib/node.io/utils.js
  4. +13 −11 package.json
@@ -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')
};
View
@@ -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) {
View
@@ -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();
+ }
+ });
+ });
+ });
+};
View
@@ -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",
@@ -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.