hummingbird-core
Advanced tools
Comparing version 0.0.2 to 0.0.3
@@ -39,3 +39,3 @@ var express = require('express'); | ||
// Init queue | ||
Queue.connect(); | ||
Queue.connect(hummingbird.config.redis); | ||
@@ -42,0 +42,0 @@ |
@@ -0,1 +1,3 @@ | ||
var async = require('async'); | ||
/** | ||
@@ -10,6 +12,13 @@ * Pipeline | ||
post: function(post) { | ||
// Parse post sentiment | ||
//post.attach('sentiment', Sediment.analyze(post.text())); | ||
Queue.post(post); | ||
if (hummingbird.plugins.length > 0) { | ||
async.reduce(hummingbird.plugins, post, function(memo, item, callback) { | ||
item(memo, function(err, p) { | ||
callback(null, memo); | ||
}); | ||
}, function(err, final_post) { | ||
if (!err) Queue.post(post); | ||
}); | ||
} else { | ||
Queue.post(post); | ||
} | ||
}, | ||
@@ -16,0 +25,0 @@ |
var sugar = require('sugar'); | ||
var winston = require('winston'); | ||
/** | ||
* Services | ||
* @constructor | ||
*/ | ||
var Services = function() { | ||
@@ -11,2 +16,6 @@ | ||
/** | ||
* Proxy command to service | ||
*/ | ||
Services.prototype.command = function(service, params) { | ||
@@ -17,2 +26,8 @@ this._services[service].command(params.model, params.action, params.param); | ||
/** | ||
* Load services | ||
* Does require('hummingbird-service'); for each, | ||
* Attaches service responder | ||
*/ | ||
Services.prototype.load = function() { | ||
@@ -32,2 +47,5 @@ var self = this; | ||
/** | ||
* Initialize accounts and keywords | ||
*/ | ||
Services.prototype.initialize = function(cb) { | ||
@@ -45,3 +63,5 @@ winston.info('Initializing service information...'); | ||
/** | ||
* Attach event listeners to service hose | ||
*/ | ||
Services.prototype.connect = function(service) { | ||
@@ -55,2 +75,6 @@ service.hose.on('post', function(post) { Pipeline.post(post) }); | ||
/** | ||
* Boot services | ||
* Run Service.boot() with creds, accts, keywords | ||
*/ | ||
Services.prototype.boot = function() { | ||
@@ -75,2 +99,6 @@ var self = this; | ||
/** | ||
* Reduce/filter model to service, returning condensed version | ||
*/ | ||
Services.prototype.filterModel = function(model, service) { | ||
@@ -86,2 +114,3 @@ return model.filter(function(n) { | ||
/** EXPORT */ | ||
module.exports = Services = new Services(); |
{ | ||
"name": "hummingbird-core", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Core components for hummingbird.", | ||
@@ -30,4 +30,5 @@ "main": "app.js", | ||
"hiredis": "^0.1.16", | ||
"sugar": "^1.4.1" | ||
"sugar": "^1.4.1", | ||
"async": "^0.6.2" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
15692
509
8
+ Addedasync@^0.6.2
+ Addedasync@0.6.2(transitive)