mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-01-11 06:25:57 +00:00
refactor to addPluginType
This commit is contained in:
parent
0282e7d71c
commit
a3de13e011
@ -120,52 +120,50 @@ Plugin.prototype.interceptLogs = function(context) {
|
|||||||
// TODO: add deploy provider
|
// TODO: add deploy provider
|
||||||
Plugin.prototype.registerClientWeb3Provider = function(cb) {
|
Plugin.prototype.registerClientWeb3Provider = function(cb) {
|
||||||
this.clientWeb3Providers.push(cb);
|
this.clientWeb3Providers.push(cb);
|
||||||
this.pluginTypes.push('clientWeb3Provider');
|
this.addPluginType('clientWeb3Provider');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerContractsGeneration = function(cb) {
|
Plugin.prototype.registerContractsGeneration = function(cb) {
|
||||||
this.contractsGenerators.push(cb);
|
this.contractsGenerators.push(cb);
|
||||||
this.pluginTypes.push('contractGeneration');
|
this.addPluginType('contractGeneration');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerPipeline = function(matcthingFiles, cb) {
|
Plugin.prototype.registerPipeline = function(matcthingFiles, cb) {
|
||||||
// TODO: generate error for more than one pipeline per plugin
|
// TODO: generate error for more than one pipeline per plugin
|
||||||
this.pipeline.push({matcthingFiles: matcthingFiles, cb: cb});
|
this.pipeline.push({matcthingFiles: matcthingFiles, cb: cb});
|
||||||
this.pluginTypes.push('pipeline');
|
this.addPluginType('pipeline');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.addFileToPipeline = function(file, intendedPath, options) {
|
Plugin.prototype.addFileToPipeline = function(file, intendedPath, options) {
|
||||||
this.pipelineFiles.push({file: file, intendedPath: intendedPath, options: options});
|
this.pipelineFiles.push({file: file, intendedPath: intendedPath, options: options});
|
||||||
this.pluginTypes.push('pipelineFiles');
|
this.addPluginType('pipelineFiles');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.addContractFile = function(file) {
|
Plugin.prototype.addContractFile = function(file) {
|
||||||
this.contractsFiles.push(file);
|
this.contractsFiles.push(file);
|
||||||
this.pluginTypes.push('contractFiles');
|
this.addPluginType('contractFiles');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerConsoleCommand = function(cb) {
|
Plugin.prototype.registerConsoleCommand = function(cb) {
|
||||||
this.console.push(cb);
|
this.console.push(cb);
|
||||||
this.pluginTypes.push('console');
|
this.addPluginType('console');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO: this only works for services done on startup
|
// TODO: this only works for services done on startup
|
||||||
Plugin.prototype.registerServiceCheck = function(checkName, checkFn, time) {
|
Plugin.prototype.registerServiceCheck = function(checkName, checkFn, time) {
|
||||||
this.serviceChecks.push({checkName: checkName, checkFn: checkFn, time: time});
|
this.serviceChecks.push({checkName: checkName, checkFn: checkFn, time: time});
|
||||||
this.pluginTypes.push('serviceChecks');
|
this.addPluginType('serviceChecks');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.has = function(pluginType) {
|
Plugin.prototype.has = function(pluginType) {
|
||||||
return this.pluginTypes.indexOf(pluginType) >= 0;
|
return this.pluginTypes.indexOf(pluginType) >= 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Plugin.prototype.addPluginType = function(pluginType) {
|
||||||
|
this.pluginTypes.push(pluginType);
|
||||||
|
this.pluginTypes = _.uniq(this.pluginTypes);
|
||||||
|
};
|
||||||
|
|
||||||
Plugin.prototype.generateProvider = function(args) {
|
Plugin.prototype.generateProvider = function(args) {
|
||||||
return this.clientWeb3Providers.map(function(cb) {
|
return this.clientWeb3Providers.map(function(cb) {
|
||||||
return cb.call(this, args);
|
return cb.call(this, args);
|
||||||
@ -180,39 +178,33 @@ Plugin.prototype.generateContracts = function(args) {
|
|||||||
|
|
||||||
Plugin.prototype.registerContractConfiguration = function(config) {
|
Plugin.prototype.registerContractConfiguration = function(config) {
|
||||||
this.contractsConfigs.push(config);
|
this.contractsConfigs.push(config);
|
||||||
this.pluginTypes.push('contractsConfig');
|
this.addPluginType('contractsConfig');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerCompiler = function(extension, cb) {
|
Plugin.prototype.registerCompiler = function(extension, cb) {
|
||||||
this.compilers.push({extension: extension, cb: cb});
|
this.compilers.push({extension: extension, cb: cb});
|
||||||
this.pluginTypes.push('compilers');
|
this.addPluginType('compilers');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerUploadCommand = function(cmd, cb) {
|
Plugin.prototype.registerUploadCommand = function(cmd, cb) {
|
||||||
this.uploadCmds.push({cmd: cmd, cb: cb});
|
this.uploadCmds.push({cmd: cmd, cb: cb});
|
||||||
this.pluginTypes.push('uploadCmds');
|
this.addPluginType('uploadCmds');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.addCodeToEmbarkJS = function(code) {
|
Plugin.prototype.addCodeToEmbarkJS = function(code) {
|
||||||
this.embarkjs_code.push(code);
|
this.embarkjs_code.push(code);
|
||||||
this.pluginTypes.push('embarkjsCode');
|
this.addPluginType('embarkjsCode');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.addProviderInit = function(providerType, code, initCondition) {
|
Plugin.prototype.addProviderInit = function(providerType, code, initCondition) {
|
||||||
this.embarkjs_init_code[providerType] = this.embarkjs_init_code[providerType] || [];
|
this.embarkjs_init_code[providerType] = this.embarkjs_init_code[providerType] || [];
|
||||||
this.embarkjs_init_code[providerType].push([code, initCondition]);
|
this.embarkjs_init_code[providerType].push([code, initCondition]);
|
||||||
this.pluginTypes.push('initCode');
|
this.addPluginType('initCode');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerImportFile = function(importName, importLocation) {
|
Plugin.prototype.registerImportFile = function(importName, importLocation) {
|
||||||
this.imports.push([importName, importLocation]);
|
this.imports.push([importName, importLocation]);
|
||||||
this.pluginTypes.push('imports');
|
this.addPluginType('imports');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.registerActionForEvent = function(eventName, cb) {
|
Plugin.prototype.registerActionForEvent = function(eventName, cb) {
|
||||||
@ -220,8 +212,7 @@ Plugin.prototype.registerActionForEvent = function(eventName, cb) {
|
|||||||
this.eventActions[eventName] = [];
|
this.eventActions[eventName] = [];
|
||||||
}
|
}
|
||||||
this.eventActions[eventName].push(cb);
|
this.eventActions[eventName].push(cb);
|
||||||
this.pluginTypes.push('eventActions');
|
this.addPluginType('eventActions');
|
||||||
this.pluginTypes = _.uniq(this.pluginTypes);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Plugin.prototype.runFilePipeline = function() {
|
Plugin.prototype.runFilePipeline = function() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user