gengojs-core-modules
Advanced tools
Comparing version 2.1.0 to 2.1.1
@@ -0,1 +1,11 @@ | ||
2.1.0 / 2015-10-08 | ||
================== | ||
* Release v2.1.0. | ||
* Minor Update | ||
Simplified plugify. | ||
Updated tests. | ||
* Update | ||
Updated change log. | ||
2.0.9 / 2015-10-08 | ||
@@ -2,0 +12,0 @@ ================== |
@@ -12,33 +12,33 @@ import _ from 'lodash'; | ||
constructor(plugins, options, defaults) { | ||
log.debug(`class: ${Plugify.name}`, `process: constructor`); | ||
// Local options | ||
this.options = {}; | ||
this.defaults = {}; | ||
// Initialize the plugins | ||
this.plugins = (() => { | ||
if (_.isEmpty(defaults)) { | ||
_.forEach(['api', 'backend', 'parser', 'header', 'localize', 'router'], item => { | ||
this.defaults[this.normalize(item)] = () => {}; | ||
log.debug(`class: ${Plugify.name}`, `process: constructor`); | ||
// Local options | ||
this.options = {}; | ||
this.defaults = {}; | ||
// Initialize the plugins | ||
this.plugins = (() => { | ||
if (_.isEmpty(defaults)) { | ||
_.forEach(['api', 'backend', 'parser', 'header', 'localize', 'router'], item => { | ||
this.defaults[this.normalize(item)] = () => {}; | ||
}); | ||
return this.defaults; | ||
} | ||
_.forOwn(defaults, (value, key) => { | ||
if (_.isFunction(value) && _.isPlainObject(value())) | ||
this.defaults[key] = value(); | ||
}); | ||
return this.defaults; | ||
} | ||
_.forOwn(defaults, (value, key) => { | ||
if (_.isFunction(value) && _.isPlainObject(value())) | ||
this.defaults[key] = value(); | ||
})(); | ||
this.register(plugins); | ||
_.forOwn(this.plugins, (value, key) => { | ||
var name = value.package ? value.package.name : ''; | ||
log.info( | ||
`class: ${Plugify.name}`, | ||
`plugins: name - ${name}, type - ${key}, typeof - ${typeof value}`); | ||
}); | ||
return this.defaults; | ||
})(); | ||
this.register(plugins); | ||
_.forOwn(this.plugins, (value, key) => { | ||
var name = value.package ? value.package.name : ''; | ||
log.info( | ||
`class: ${Plugify.name}`, | ||
`plugins: name - ${name}, type - ${key}, typeof - ${typeof value}`); | ||
}); | ||
_.defaultsDeep(options, this.options); | ||
} | ||
/** | ||
* Registers the plugin | ||
* @param {Function | Array | Object} The plugin to register | ||
*/ | ||
_.defaultsDeep(options, this.options); | ||
} | ||
/** | ||
* Registers the plugin | ||
* @param {Function | Array | Object} The plugin to register | ||
*/ | ||
register(plugins) { | ||
@@ -45,0 +45,0 @@ log.debug(`class: ${Plugify.name}`, `process: register`); |
{ | ||
"name": "gengojs-core-modules", | ||
"version": "2.1.0", | ||
"version": "2.1.1", | ||
"description": "gengo.js core modules is a set of modules that helps the core to function properly.", | ||
@@ -5,0 +5,0 @@ "main": "src/modules/index.js", |
@@ -30,13 +30,2 @@ 'use strict'; | ||
var Plugify = (function () { | ||
/** | ||
* plugins - The user's plugins ( [], function, {} ) | ||
* options - The user's options ( {} ) | ||
* defaults - The gengojs-default-pack ( { //...// }, {} ) | ||
* | ||
* Psuedo code: | ||
* case 1: 'plugins' may be an array of random plugins. | ||
* -> assert that each plugin are properly shipped | ||
* -> | ||
*/ | ||
function Plugify(plugins, options, defaults) { | ||
@@ -81,2 +70,7 @@ var _this = this; | ||
/** | ||
* Registers the plugin | ||
* @param {Function | Array | Object} The plugin to register | ||
*/ | ||
_createClass(Plugify, [{ | ||
@@ -121,3 +115,3 @@ key: 'register', | ||
/** | ||
* Sets the attributes in the plugin | ||
* Sets the attributes of the plugin | ||
* @param {Object} plugin The plugin to set its attributes. | ||
@@ -124,0 +118,0 @@ * @param {Object} options The options to apply |
Sorry, the diff of this file is not supported yet
89356
1584