Skip to content

Commit

Permalink
Updated README and made some JSLint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
chriso committed Nov 16, 2010
1 parent 1f8d7e7 commit a3e56c1
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 19 deletions.
13 changes: 8 additions & 5 deletions README.md
Expand Up @@ -12,16 +12,19 @@ For usage details, run
## Why node.io?

- Seamlessly distribute work across child processes and servers (soon)
- Create modular and extensible jobs for scraping and processing data
- Seamlessly distribute work between child processes and servers (soon)
- Handles a variety of input / output situations
* Reading / writing lines to and from files
* Reading all files in a directory (and recursing if specified)
* To / from a database
* STDIN / STDOUT
* Piping between node.io jobs
* Any combination of the above
* Custom IO / any combination of the above
- Includes a robust framework for scraping and selecting HTML data
- Support for proxied requests
- Provides support for retries and timeouts
- Support for a variety of proxies when making requests
- Includes a data validation and sanitization framework
- Provides support for retries, timeouts, dynamically adding input, etc.

## Examples

Expand All @@ -33,7 +36,7 @@ Coming soon. See [http://node.io/](http://node.io/) for updates

## Credits

node.io uses the following (awesome) libraries:
node.io uses the following awesome libraries:

- [tautologistics'](https://github.com/tautologistics) [node-htmlparser](https://github.com/tautologistics/node-htmlparser)
- [harryf's](https://github.com/harryf) [soupselect](https://github.com/harryf/node-soupselect)
Expand Down
20 changes: 9 additions & 11 deletions lib/node.io/job.js
Expand Up @@ -5,7 +5,6 @@
var default_options = {
max: 1,
take: 1,
timeout: 0,
retries: 2,
timeout: false,
flatten: true,
Expand Down Expand Up @@ -45,8 +44,8 @@ var Job = exports.Job = function(options, methods) {
}

Job.prototype.extend = function(options, methods, extend_this) {
var i, job;

var job;
if (!extend_this) {
job = new Job(this.options, this.methods);
} else {
Expand All @@ -56,23 +55,24 @@ Job.prototype.extend = function(options, methods, extend_this) {
//Set default options
if (typeof job.options === 'undefined') {
job.options = {};
for (var i in default_options) {
for (i in default_options) {
job.options[i] = default_options[i];
}
}

//Extend/set options with the user specified ops
if (typeof options === 'object') {
for (var i in options) {
for (i in options) {
job.options[i] = options[i];
}
}

//Extend/set job methods
job.methods = job.methods || {};
if (typeof methods === 'object') {

//TODO: Implement a way of calling parent methods, e.g. _super_()
for(var i in methods) {
for(i in methods) {
job.methods[i] = methods[i];
job[i] = methods[i];
}
Expand All @@ -93,16 +93,16 @@ Job.prototype.cancelPreviousTimeouts = function() {
Job.prototype.emit = function() {
var self = this;

if (this.after_timeout) return;
if (this.after_timeout) {
return;
}

var process_order = ['take','run','output_hook'];

this.cancelPreviousTimeouts();

//No methods left? we're done
if (this.stage >= process_order.length) {
return;
}
if (this.stage >= process_order.length) return;

//Get the next method in the chain
var next = process_order[this.stage++];
Expand All @@ -129,8 +129,6 @@ Job.prototype.emit = function() {
}

Job.prototype.reduce_hook = function(data, callback) {
var self = this;

if (typeof this.reduce !== 'function') {
if (callback) callback.apply(this, [data]);
return;
Expand Down
4 changes: 1 addition & 3 deletions lib/node.io/processor.js
Expand Up @@ -47,7 +47,7 @@ exports.start = function(job, options, callback) {
var job_obj;
if (typeof job === 'string') {
if (!~job.indexOf('/')) job = process.cwd() + '/' + job;
job_obj = p.loadJob(job)
job_obj = p.loadJob(job);
} else {
job_obj = job;
job = crc32(JSON.stringify(job));
Expand Down Expand Up @@ -558,8 +558,6 @@ Processor.prototype.instanceSpawn = function(job) {
}
}

var x = y = z = 0;

Processor.prototype.instanceStart = function(job, input) {
var self = this, j = this.jobs[job];

Expand Down

0 comments on commit a3e56c1

Please sign in to comment.