addFileToPipeline test and registerBeforeDeploy with new arg

This commit is contained in:
Jonathan Rainville 2018-04-25 15:01:01 -04:00
parent c818326f2e
commit 61be2c7bd7
5 changed files with 17 additions and 8 deletions

View File

@ -280,17 +280,17 @@ class Deploy {
// calling each beforeDeploy handler declared by the plugin // calling each beforeDeploy handler declared by the plugin
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => { async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => {
function beforeDeployCb(resObj){
contract.code = resObj.contractCode;
eachCb();
}
beforeDeployFn({ beforeDeployFn({
embarkDeploy: self, embarkDeploy: self,
pluginConfig: plugin.pluginConfig, pluginConfig: plugin.pluginConfig,
deploymentAccount: deploymentAccount, deploymentAccount: deploymentAccount,
contract: contract, contract: contract,
callback: callback: beforeDeployCb
(function(resObj){ }, beforeDeployCb);
contract.code = resObj.contractCode;
eachCb();
})
});
}, () => { }, () => {
//self.logger.info('All beforeDeploy handlers of the plugin has processed.'); //self.logger.info('All beforeDeploy handlers of the plugin has processed.');
eachPluginCb(); eachPluginCb();

View File

@ -286,7 +286,7 @@ Config.prototype.loadFiles = function(files) {
} }
}); });
filesFromPlugins.filter(function(file) { filesFromPlugins.filter(function(file) {
if (utils.fileMatchesPattern(files, file.intendedPath)) { if ((file.intendedPath && utils.fileMatchesPattern(files, file.intendedPath)) || utils.fileMatchesPattern(files, file.file)) {
readFiles.push(file); readFiles.push(file);
} }
}); });

View File

@ -0,0 +1 @@
console.log('File added to the pipeline using embark.addFileToPipeline');

View File

@ -19,4 +19,12 @@ module.exports = function (embark) {
} }
}); });
embark.addContractFile("./contracts/pluginSimpleStorage.sol"); embark.addContractFile("./contracts/pluginSimpleStorage.sol");
embark.addFileToPipeline('./fileInPipeline.js');
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
embark.registerBeforeDeploy(function(options, callback) {
// Just calling register to prove it works. We don't actually want to change the contracts
callback({contractCode: options.contract.code});
});
}; };

View File

@ -14,7 +14,7 @@
}, },
"dependencies": { "dependencies": {
"bootstrap": "^3.3.6", "bootstrap": "^3.3.6",
"embark-service": "./extensions/embark-service", "embark-service": "file:extensions/embark-service",
"jquery": "^1.11.3", "jquery": "^1.11.3",
"react": "^16.0.0", "react": "^16.0.0",
"react-bootstrap": "^0.32.0", "react-bootstrap": "^0.32.0",