|
1 | | -var Haml = require('haml'); |
| 1 | +const Haml = require('haml'); |
2 | 2 |
|
3 | | -module.exports = function(embark) { |
4 | | - embark.registerServiceCheck('PluginService', function(cb) { |
| 3 | +module.exports = function (embark) { |
| 4 | + embark.registerServiceCheck('PluginService', function (cb) { |
5 | 5 | cb({name: "ServiceName", status: "on"}); |
6 | 6 | }); |
7 | 7 |
|
8 | | - embark.registerPipeline((embark.pluginConfig.files || ['**/*.haml']), function(opts) { |
9 | | - var source = opts.source; |
10 | | - return Haml.render(source); |
| 8 | + embark.registerPipeline((embark.pluginConfig.files || ['**/*.haml']), function (opts) { |
| 9 | + return Haml.render(opts.source); |
11 | 10 | }); |
| 11 | + |
| 12 | + embark.registerContractConfiguration({ |
| 13 | + "default": { |
| 14 | + "contracts": { |
| 15 | + "PluginStorage": { |
| 16 | + "args": ["$SimpleStorage"] |
| 17 | + } |
| 18 | + } |
| 19 | + } |
| 20 | + }); |
| 21 | + 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 | + }); |
| 30 | + |
| 31 | + embark.registerClientWeb3Provider(function(options) { |
| 32 | + return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));"; |
| 33 | + }); |
| 34 | + |
| 35 | + embark.registerConsoleCommand((cmd) => { |
| 36 | + if (cmd === "hello") { |
| 37 | + return "hello there!"; |
| 38 | + } |
| 39 | + // continue to embark or next plugin; |
| 40 | + return false; |
| 41 | + }); |
| 42 | + |
| 43 | + embark.events.on("contractsDeployed", function() { |
| 44 | + embark.logger.info("plugin says: your contracts have been deployed"); |
| 45 | + }); |
| 46 | + |
12 | 47 | }; |
0 commit comments