Skip to content

Commit

Permalink
test/seneca.test.js passing without gate-executor and new bootstrap l…
Browse files Browse the repository at this point in the history
…ogic
  • Loading branch information
mcollina committed Apr 28, 2016
1 parent a95ad56 commit 200b3ee
Show file tree
Hide file tree
Showing 6 changed files with 200 additions and 189 deletions.
3 changes: 1 addition & 2 deletions lib/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,8 +238,7 @@ exports.makedie = function (instance, ctxt) {

var logargs = [ctxt.type, ctxt.plugin, ctxt.tag, ctxt.id,
err.code, err.message, err.details,
instance.fixedargs.fatal$ ? 'all-errors-fatal' : '-',
ctxt.callpoint()]
instance.fixedargs.fatal$ ? 'all-errors-fatal' : '-']

instance.log.fatal.apply(instance, logargs)

Expand Down
16 changes: 8 additions & 8 deletions lib/logging.js
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,7 @@ function parse_command_line (spec, logspec, flags) {

exports.parse_command_line = parse_command_line

exports.log_act_in = function (instance, actinfo, actmeta, args, prior_ctxt, act_callpoint) {
exports.log_act_in = function (instance, actinfo, actmeta, args, prior_ctxt) {
actmeta = actmeta || {}
if (actmeta.sub) {
return
Expand All @@ -544,12 +544,12 @@ exports.log_act_in = function (instance, actinfo, actmeta, args, prior_ctxt, act
actmeta.client ? 'CLIENT' : (origin ? 'LISTEN' : '-'),
origin || '-',
args.gate$ ? 'GATE' : '-',
args.caller$ || act_callpoint
args.caller$
]
})
}

exports.log_act_out = function (instance, actinfo, actmeta, args, result, prior_ctxt, act_callpoint) {
exports.log_act_out = function (instance, actinfo, actmeta, args, result, prior_ctxt) {
actmeta = actmeta || {}
if (actmeta.sub) {
return
Expand All @@ -576,13 +576,13 @@ exports.log_act_out = function (instance, actinfo, actmeta, args, result, prior_
accept || actinfo.listen || '-',
actinfo.duration,
args.gate$ ? 'GATE' : '-',
args.caller$ || act_callpoint
args.caller$
])
}
)
}

exports.log_act_err = function (instance, actinfo, actmeta, args, prior_ctxt, err, act_callpoint) {
exports.log_act_err = function (instance, actinfo, actmeta, args, prior_ctxt, err) {
actmeta = actmeta || {}
if (err && err.log === false) {
return
Expand All @@ -608,11 +608,11 @@ exports.log_act_err = function (instance, actinfo, actmeta, args, prior_ctxt, er
err.code,
Jsonic.stringify(err.details),
err.stack,
args.caller$ || act_callpoint
args.caller$
)
}

exports.log_act_cache = function (instance, actinfo, actmeta, args, prior_ctxt, act_callpoint) {
exports.log_act_cache = function (instance, actinfo, actmeta, args, prior_ctxt) {
actmeta = actmeta || {}

instance.log.debug(
Expand All @@ -631,7 +631,7 @@ exports.log_act_cache = function (instance, actinfo, actmeta, args, prior_ctxt,
? actmeta.descdata(args)
: Jsonic.stringify(args),
'A=' + actmeta.id,
args.caller$ || act_callpoint
args.caller$
]
})
}
Expand Down
26 changes: 6 additions & 20 deletions lib/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ var internals = {
})
}

module.exports.register = function (so, callpoint) {
module.exports.register = function (so) {
var seq = 0

return function api_register (plugin) {
return function api_register (plugin, done) {
var seneca = this

internals.schema.validate(plugin, function (err) {
Expand All @@ -49,16 +49,14 @@ module.exports.register = function (so, callpoint) {
preload = _.isFunction(preload) ? preload : _.noop
var meta = preload.call(seneca, plugin) || {}

function plugin_definition (msg, plugin_done) {
var seneca = this

function plugin_definition () {
var fullname = plugin.name + (plugin.tag ? '/' + plugin.tag : '')
plugin.fullname = fullname

var delegate = make_delegate(seneca, plugin)
var plugin_options = resolve_options(fullname, plugin, seneca)

seneca.log.debug('register', 'init', fullname, callpoint(), plugin_options)
seneca.log.debug('register', 'init', fullname, null, plugin_options)

meta = define_plugin(delegate, plugin, plugin_options)

Expand Down Expand Up @@ -143,7 +141,7 @@ module.exports.register = function (so, callpoint) {

seneca.log.debug('register', 'ready', fullname, out)

plugin_done()
done()
}
)
}
Expand All @@ -161,19 +159,7 @@ module.exports.register = function (so, callpoint) {
plugin_define_pattern.tag = plugin.tag
}

seneca
.add(plugin_define_pattern, plugin_definition)
.act({
role: 'seneca',
plugin: 'define',
name: plugin.name,
tag: plugin.tag,
seq: seq,
default$: {},
gate$: true,
fatal$: true,
local$: true
})
plugin_definition()

// needed for seneca.export to operate for plugins like seneca-web
var preloadName = meta.name || plugin.name
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"dependencies": {
"archy": "1.0.0",
"eraro": "0.4.1",
"gate-executor": "0.4.0",
"fastq": "^1.3.0",
"gex": "0.2.2",
"jsonic": "0.2.2",
"lodash": "4.5.0",
Expand Down

0 comments on commit 200b3ee

Please sign in to comment.