Comparing version 0.5.6 to 0.5.7
@@ -5,3 +5,3 @@ /* Copyright (c) 2010-2013 Richard Rodger */ | ||
var VERSION = '0.5.6' | ||
var VERSION = '0.5.7' | ||
@@ -644,2 +644,4 @@ var common = require('./common') | ||
// TODO: move to separate file, document!!! | ||
paramcheck.http = parambulator( | ||
@@ -719,16 +721,2 @@ {type$:'object',required$:['pin','map'],string$:['prefix'],object$:['pin','map']}, | ||
/* | ||
function defaulthandler(req,res,args,act,responder,handlerspec) { | ||
var si = req.seneca || instance | ||
act.call(si,args,function(){ | ||
var responder_args = arrayify(arguments) | ||
responder_args.unshift(handlerspec) | ||
responder_args.unshift(res) | ||
responder_args.unshift(req) | ||
responder.apply(this,responder_args) | ||
}) | ||
} | ||
*/ | ||
function defaultresponder(req,res,handlerspec,err,obj) { | ||
@@ -790,3 +778,3 @@ var outobj; | ||
return httprouter(function(http){ | ||
var maprouter = httprouter(function(http){ | ||
for( var fname in pin ) { | ||
@@ -829,2 +817,25 @@ var act = pin[fname] | ||
}) | ||
return function(req,res,next) { | ||
var si = req.seneca || instance | ||
if( spec.preware ) { | ||
spec.preware.call(si,req,res,do_maprouter) | ||
} | ||
else do_maprouter() | ||
function do_maprouter(err) { | ||
if(err ) return next(err); | ||
maprouter(req,res,function(err){ | ||
if(err ) return next(err); | ||
if( spec.postware ) { | ||
spec.postware.call(si,req,res,next) | ||
} | ||
else next() | ||
}) | ||
} | ||
} | ||
} | ||
@@ -951,2 +962,8 @@ | ||
// FIX: need a much better way to support layered actions | ||
// this ".handle" hack is just to make seneca.close work | ||
if( _.isFunction(actfunc.handle) ) { | ||
actmeta.handle = actfunc.handle | ||
} | ||
if( addroute ) { | ||
@@ -1181,7 +1198,14 @@ var plugin_name = (actmeta.plugin_nameref && actmeta.plugin_nameref[0]) || '-' | ||
self.close = function(cb){ | ||
self.log.info('close') | ||
if( $.entity ) { | ||
$.entity.close$(cb) | ||
} | ||
self.close = function(done){ | ||
self.log.info('close','start') | ||
self.act('role:seneca,cmd:close',function(err){ | ||
// FIX: needs to a close action | ||
if( $.entity ) { | ||
$.entity.close$(function(enterr){ | ||
self.log.info('close','end',err,enterr) | ||
done && done(err||enterr||null) | ||
}) | ||
} | ||
}) | ||
} | ||
@@ -1522,4 +1546,8 @@ | ||
// set default commands | ||
// FIX: such a hack! | ||
var closehandler_functions = [] | ||
var closehandler = function(args,cb){ | ||
var instance = this | ||
var errs = [] | ||
@@ -1529,3 +1557,3 @@ var outs = [] | ||
if( i < closehandler_functions.length ) { | ||
closehandler_functions[i](args,function(err,out){ | ||
closehandler_functions[i].call(instance,args,function(err,out){ | ||
if( err ) errs.push(err); | ||
@@ -1539,3 +1567,3 @@ outs.push(out) | ||
var lastout = 0 < outs.length ? outs[outs.length-1] : null | ||
cb(lasterr,lastout) | ||
cb.call(instance,lasterr,lastout) | ||
} | ||
@@ -1542,0 +1570,0 @@ } |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "0.5.6", | ||
"version": "0.5.7", | ||
"license": "MIT", | ||
@@ -15,0 +15,0 @@ "homepage": "http://senecajs.org", |
@@ -12,3 +12,4 @@ /* Copyright (c) 2012-2013 Richard Rodger */ | ||
module.exports = function config( seneca,opts,cb ) { | ||
module.exports = function config( opts,cb ) { | ||
var seneca = this | ||
@@ -20,6 +21,6 @@ var ref = {config:{}} | ||
// TODO: need an async way to this | ||
//fs.readFile( opts.file, function(err,text){ | ||
//if( err ) return cb(err); | ||
var text = fs.readFileSync( opts.file ) | ||
ref.config = JSON.parse(text) | ||
cb() | ||
@@ -26,0 +27,0 @@ } |
@@ -16,5 +16,5 @@ # seneca - Node.js module | ||
Current Version: 0.5.6 | ||
Current Version: 0.5.7 | ||
Tested on: node 0.8.16 | ||
Tested on: node 0.10.6 | ||
@@ -21,0 +21,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
478206
6180