Comparing version 0.7.1 to 0.7.5
@@ -14,9 +14,9 @@ var gulp = global.gulp = require('gulp'), | ||
gulp.task('doc', function (cb) { | ||
gulp.src('./lib/**/*.js') | ||
.pipe( global.plugins.yuidoc() ) | ||
.pipe( gulp.dest('./doc') ) | ||
.on( 'end', cb ); | ||
}); | ||
gulp.task( 'doc', function(callback) { | ||
var doccoOptions; | ||
return gulp.src("./test/mochaTest.js") | ||
.pipe( global.plugins.docco( doccoOptions ) ) | ||
.pipe( gulp.dest('./doc') ); | ||
} ); | ||
gulp.task( 'default', [ 'jshint', 'mocha', 'doc' ] ); |
@@ -42,3 +42,3 @@ var async = require('async'); | ||
if( err ) | ||
return this.logger.harconlog( err ); | ||
this.logger.harconlog( err ); | ||
@@ -76,4 +76,5 @@ _.each( self.firestarters, function( fs ){ | ||
if( comm.callback ) | ||
if( comm.callback ){ | ||
self.appease( comm, err, results ); | ||
} | ||
} | ||
@@ -80,0 +81,0 @@ ); |
@@ -71,3 +71,3 @@ var _ = require('lodash'); | ||
err = _.filter( _.map( responseComms, function(responseComm){ return responseComm.error; } ), function(er){ return er; }); | ||
if( err.length === 0 ) err = null; | ||
err = err.length === 0 ? null : err[0]; | ||
@@ -99,8 +99,12 @@ res = _.filter( _.map( responseComms, function(responseComm){ return responseComm.response; } ), function(resp){ return resp; }); | ||
self.fn.apply( | ||
{ comm: comm, ignite: function( ){ | ||
self.burst( comm, arguments ); | ||
} }, | ||
[].concat( comm.params ).concat( function(err, res){ callback( err, comm.twist(self.name, err, res) ); } ) | ||
); | ||
try { | ||
self.fn.apply( | ||
{ comm: comm, ignite: function( ){ | ||
self.burst( comm, arguments ); | ||
} }, | ||
[].concat( comm.params ).concat( function(err, res){ callback( err, comm.twist(self.name, err, res) ); } ) | ||
); | ||
} catch (ex) { | ||
callback( ex, comm.twist(self.name, ex, null) ); | ||
} | ||
}; | ||
@@ -107,0 +111,0 @@ |
@@ -67,6 +67,10 @@ var _ = require('lodash'); | ||
}; | ||
this.object[ eventName ].apply( | ||
this.object, | ||
[].concat( comm.params ).concat( function(err, res){ callback( err, comm.twist(self.name, err, res) ); } ) | ||
); | ||
try { | ||
this.object[ eventName ].apply( | ||
this.object, | ||
[].concat( comm.params ).concat( function(err, res){ callback( err, comm.twist(self.name, err, res) ); } ) | ||
); | ||
} catch (ex) { | ||
callback( ex, comm.twist(self.name, ex, null) ); | ||
} | ||
}; | ||
@@ -73,0 +77,0 @@ |
@@ -9,3 +9,3 @@ var _ = require('lodash'); | ||
var VERSION = exports.VERSION = '0.7.1'; | ||
var VERSION = exports.VERSION = '0.7.5'; | ||
var Logger = require('../lib/Logger'); | ||
@@ -12,0 +12,0 @@ /** |
{ | ||
"name": "harcon", | ||
"version": "0.7.1", | ||
"version": "0.7.5", | ||
"description": "Messaging/Service Bus for the harmonic convergence of node-based enterprise entities.", | ||
@@ -37,6 +37,6 @@ "keywords": [ | ||
"gulp": "latest", | ||
"gulp-docco": "latest", | ||
"gulp-jshint": "latest", | ||
"gulp-load-plugins": "latest", | ||
"gulp-mocha": "latest", | ||
"gulp-yuidoc": "latest" | ||
"gulp-mocha": "latest" | ||
}, | ||
@@ -46,3 +46,3 @@ "engines": { | ||
}, | ||
"_id": "harcon@0.7.1" | ||
"_id": "harcon@0.7.5" | ||
} |
@@ -7,2 +7,3 @@ var chai = require("chai"); | ||
// Requires harcon. In your app the form 'require('harcon');' should be used | ||
var Inflicter = require('../lib/Inflicter'); | ||
@@ -15,7 +16,11 @@ | ||
before(function(done){ | ||
// Initializes the Harcon system | ||
inflicter = new Inflicter( { logger: { file: 'test.log', level: 'debug' }, idLength: 32 } ); | ||
// Publishes an event listener function: Peter. It just sends a simple greetings in return | ||
inflicter.addict('peter', 'greet.*', function(greetings1, greetings2, callback){ | ||
callback(null, 'Hi there!'); | ||
} ); | ||
// Publishes another function listening all messages which name starts with 'greet'. It just sends a simple greetings in return | ||
inflicter.addict('walter', 'greet.*', function(greetings1, greetings2, callback){ | ||
@@ -25,5 +30,7 @@ callback(null, 'My pleasure!'); | ||
// Publishes an event handler Object: Marie. An event lister object encloses its name, context and service functions | ||
marie = { | ||
name: 'marie', | ||
context: 'greet', | ||
// Simple service function listening to the greet.simple message where greet comes from context and simple is identified by the name of the fuction. | ||
simple: function(greetings1, greetings2, callback){ | ||
@@ -39,2 +46,3 @@ marie.greetings = [ greetings1, greetings2 ]; | ||
context: 'morning', | ||
// When Julie is woken up, send a gentle message to everyone listening to such messages... Walter and Pater namely | ||
wakeup: function( callback ){ | ||
@@ -53,2 +61,3 @@ this.ignite( 'greet.gentle', 'It is morning!', 'Time to wake up!', function(err, res){ | ||
it('Simple greetings is', function(done){ | ||
// Sending a greetings message with 2 parameters and waiting for the proper answer | ||
inflicter.ignite( 'greet.simple', 'whatsup?', 'how do you do?', function(err, res){ | ||
@@ -70,2 +79,3 @@ console.log( err, res ); | ||
it('Morning greetings is', function(done){ | ||
// Sending a morning message and waiting for the proper answer | ||
inflicter.ignite( 'morning.wakeup', function(err, res){ | ||
@@ -80,4 +90,6 @@ console.log( err, res ); | ||
after(function(done){ | ||
// Shuts down Harcon when it is not needed anymore | ||
inflicter.close(); | ||
done(); | ||
}); | ||
}); |
407758
25
1292