global class: add methods

This commit is contained in:
Austen Collins 2015-10-13 09:02:13 -07:00
parent 84bd16d4a2
commit ec14dbdebb

View File

@ -40,22 +40,22 @@ let JAWS = class JAWS {
// Create registry for actions, with defaults
this.actions = {
ProjectCreate: null,
StageCreate: null,
RegionCreate: null,
ModuleCreate: null,
ModulePostInstall: null,
LambdaPackageNodeJs0_10_32: null,
LambdaUpload: null,
LambdaProvision: null,
ApiGatewayProvision: null,
ResourcesProvision: null,
EnvList: null,
EnvGet: null,
EnvSet: null,
TagResource: null,
LambdaRun: null,
Dash: null,
ProjectCreate: null,
StageCreate: null,
RegionCreate: null,
ModuleCreate: null,
ModulePostInstall: null,
LambdaPackageNodeJs: null,
LambdaUpload: null,
LambdaProvision: null,
ApiGatewayProvision: null,
ResourcesProvision: null,
EnvList: null,
EnvGet: null,
EnvSet: null,
TagResource: null,
LambdaRun: null,
Dash: null,
};
// Create registry for hooks
@ -70,8 +70,8 @@ let JAWS = class JAWS {
PostModuleCreate: [],
PreModulePostInstall: [],
PostModulePostInstall: [],
PreLambdaPackageNodeJs0_10_32: [],
PostLambdaPackageNodeJs0_10_32: [],
PreLambdaPackageNodeJs: [],
PostLambdaPackageNodeJs: [],
PreLambdaUpload: [],
PostLambdaUpload: [],
PreLambdaProvision: [],
@ -119,29 +119,37 @@ let JAWS = class JAWS {
* Set Action
*/
action(action, actionGenerator) {
action(actionName, actionGenerator) {
// Check action is valid
if (!this.actions[action]) {
if (!this.actions[actionName]) {
}
this.action = actionGenerator;
this.action[actionName] = actionGenerator;
}
/**
* Set Hook
*/
hook(hook, hookGenerator, index) {
hook(hookName, hookGenerator, index) {
// Check hook is valid
if (!this.hooks[hook]) {
if (!this.hooks[hookName]) {
}
index = (!index && index !== 0) ? this.hooks[hook].length : index;
this.hooks[hook].splice(index, 0, hookGenerator);
index = (!index && index !== 0) ? this.hooks[hookName].length : index;
this.hooks[hookName].splice(index, 0, hookGenerator);
}
/**
* Set Plugin
*/
plugin(plugin) {
this = plugin(this);
}
/**