Skip to content

Commit 61be2c7

Browse files
committed
addFileToPipeline test and registerBeforeDeploy with new arg
1 parent c818326 commit 61be2c7

File tree

5 files changed

+17
-8
lines changed

5 files changed

+17
-8
lines changed

lib/contracts/deploy.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -280,17 +280,17 @@ class Deploy {
280280

281281
// calling each beforeDeploy handler declared by the plugin
282282
async.eachSeries(plugin.beforeDeploy, (beforeDeployFn, eachCb) => {
283+
function beforeDeployCb(resObj){
284+
contract.code = resObj.contractCode;
285+
eachCb();
286+
}
283287
beforeDeployFn({
284288
embarkDeploy: self,
285289
pluginConfig: plugin.pluginConfig,
286290
deploymentAccount: deploymentAccount,
287291
contract: contract,
288-
callback:
289-
(function(resObj){
290-
contract.code = resObj.contractCode;
291-
eachCb();
292-
})
293-
});
292+
callback: beforeDeployCb
293+
}, beforeDeployCb);
294294
}, () => {
295295
//self.logger.info('All beforeDeploy handlers of the plugin has processed.');
296296
eachPluginCb();

lib/core/config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,7 +286,7 @@ Config.prototype.loadFiles = function(files) {
286286
}
287287
});
288288
filesFromPlugins.filter(function(file) {
289-
if (utils.fileMatchesPattern(files, file.intendedPath)) {
289+
if ((file.intendedPath && utils.fileMatchesPattern(files, file.intendedPath)) || utils.fileMatchesPattern(files, file.file)) {
290290
readFiles.push(file);
291291
}
292292
});
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
console.log('File added to the pipeline using embark.addFileToPipeline');

test_apps/test_app/extensions/embark-service/index.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,12 @@ module.exports = function (embark) {
1919
}
2020
});
2121
embark.addContractFile("./contracts/pluginSimpleStorage.sol");
22+
23+
embark.addFileToPipeline('./fileInPipeline.js');
24+
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
25+
26+
embark.registerBeforeDeploy(function(options, callback) {
27+
// Just calling register to prove it works. We don't actually want to change the contracts
28+
callback({contractCode: options.contract.code});
29+
});
2230
};

test_apps/test_app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
},
1515
"dependencies": {
1616
"bootstrap": "^3.3.6",
17-
"embark-service": "./extensions/embark-service",
17+
"embark-service": "file:extensions/embark-service",
1818
"jquery": "^1.11.3",
1919
"react": "^16.0.0",
2020
"react-bootstrap": "^0.32.0",

0 commit comments

Comments
 (0)