diff --git a/lib/contracts/deploy.js b/lib/contracts/deploy.js index d1b87ade..f37abec4 100644 --- a/lib/contracts/deploy.js +++ b/lib/contracts/deploy.js @@ -280,17 +280,17 @@ class Deploy { // calling each beforeDeploy handler declared by the plugin async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => { + function beforeDeployCb(resObj){ + contract.code = resObj.contractCode; + eachCb(); + } beforeDeployFn({ embarkDeploy: self, pluginConfig: plugin.pluginConfig, deploymentAccount: deploymentAccount, contract: contract, - callback: - (function(resObj){ - contract.code = resObj.contractCode; - eachCb(); - }) - }); + callback: beforeDeployCb + }, beforeDeployCb); }, () => { //self.logger.info('All beforeDeploy handlers of the plugin has processed.'); eachPluginCb(); diff --git a/lib/core/config.js b/lib/core/config.js index 89dd2b49..7061fadd 100644 --- a/lib/core/config.js +++ b/lib/core/config.js @@ -286,7 +286,7 @@ Config.prototype.loadFiles = function(files) { } }); 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); } }); diff --git a/test_apps/test_app/extensions/embark-service/fileInPipeline.js b/test_apps/test_app/extensions/embark-service/fileInPipeline.js new file mode 100644 index 00000000..85f76853 --- /dev/null +++ b/test_apps/test_app/extensions/embark-service/fileInPipeline.js @@ -0,0 +1 @@ +console.log('File added to the pipeline using embark.addFileToPipeline'); diff --git a/test_apps/test_app/extensions/embark-service/index.js b/test_apps/test_app/extensions/embark-service/index.js index 7b0d6261..be4f4366 100644 --- a/test_apps/test_app/extensions/embark-service/index.js +++ b/test_apps/test_app/extensions/embark-service/index.js @@ -19,4 +19,12 @@ module.exports = function (embark) { } }); 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}); + }); }; diff --git a/test_apps/test_app/package.json b/test_apps/test_app/package.json index 8711dde1..80985c8d 100644 --- a/test_apps/test_app/package.json +++ b/test_apps/test_app/package.json @@ -14,7 +14,7 @@ }, "dependencies": { "bootstrap": "^3.3.6", - "embark-service": "./extensions/embark-service", + "embark-service": "file:extensions/embark-service", "jquery": "^1.11.3", "react": "^16.0.0", "react-bootstrap": "^0.32.0",