updated features...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-12-11 03:34:30 +03:00
parent 777f5c6fe0
commit 35135af462

View File

@ -98,7 +98,9 @@ module.FeatureProto = {
// mixin actions...
if(this.actions != null){
actions.mixin(this.actions)
this.tag ?
actions.mixin(this.actions, {source_tag: this.tag})
: actions.mixin(this.actions)
}
// install handlers...
@ -346,6 +348,8 @@ var FeatureSetProto = {
var missing = {}
var conflicts = {}
var exclusive = {}
// reverse dependency cache...
var dependants = {}
@ -392,6 +396,7 @@ var FeatureSetProto = {
var deps = that[k].depends || []
var refs = that[k].suggested || []
var excl = that[k].exclusive || []
deps.forEach(function(n){
// expand lst with dependencies....
@ -406,8 +411,16 @@ var FeatureSetProto = {
refs.forEach(function(n){
lst.indexOf(n) < 0 && lst.push(n)
})
// build exclusive table...
excl.forEach(function(n){
var l = exclusive[n] = exclusive[n] || []
l.indexOf(k) < 0 && l.push(k)
})
}
console.log('EXCL:', exclusive)
// sort features by priority or position...
lst = lst
// remove undefined and non-features...
@ -433,7 +446,7 @@ var FeatureSetProto = {
.filter(function(e){ return disabled.indexOf(e) < 0 })
// build the sort table: [ <priority>, <index>, <elem> ]
.map(function(e, i){ return [ that[e].getPriority(), i, e ] })
// do the sort...
// sort by priority then index...
// NOTE: JS compares lists as strings so we have to compare
// the list manually...
.sort(function(a, b){ return a[0] - b[0] || a[1] - b[1] })