2018-04-25 17:05:58 +00:00
|
|
|
const Haml = require('haml');
|
2018-02-28 22:45:39 +00:00
|
|
|
|
2018-04-25 17:05:58 +00:00
|
|
|
module.exports = function (embark) {
|
|
|
|
embark.registerServiceCheck('PluginService', function (cb) {
|
2017-04-02 03:22:43 +00:00
|
|
|
cb({name: "ServiceName", status: "on"});
|
2017-03-16 11:31:52 +00:00
|
|
|
});
|
2018-02-28 22:45:39 +00:00
|
|
|
|
2018-04-25 17:05:58 +00:00
|
|
|
embark.registerPipeline((embark.pluginConfig.files || ['**/*.haml']), function (opts) {
|
|
|
|
return Haml.render(opts.source);
|
2018-02-28 22:45:39 +00:00
|
|
|
});
|
2018-04-25 17:05:58 +00:00
|
|
|
|
|
|
|
embark.registerContractConfiguration({
|
|
|
|
"default": {
|
|
|
|
"contracts": {
|
|
|
|
"PluginStorage": {
|
|
|
|
"args": ["$SimpleStorage"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
embark.addContractFile("./contracts/pluginSimpleStorage.sol");
|
2018-04-25 19:01:01 +00:00
|
|
|
|
|
|
|
embark.addFileToPipeline('./fileInPipeline.js');
|
|
|
|
embark.addFileToPipeline('./fileInPipeline.js', 'js/fileInPipeline.js');
|
|
|
|
|
2018-04-25 20:27:47 +00:00
|
|
|
embark.registerBeforeDeploy(function (options, callback) {
|
2018-04-25 19:01:01 +00:00
|
|
|
// Just calling register to prove it works. We don't actually want to change the contracts
|
|
|
|
callback({contractCode: options.contract.code});
|
|
|
|
});
|
2018-04-25 20:27:47 +00:00
|
|
|
|
|
|
|
embark.registerClientWeb3Provider(function(options) {
|
|
|
|
return "web3 = new Web3(new Web3.providers.HttpProvider('http://" + options.rpcHost + ":" + options.rpcPort + "'));";
|
|
|
|
});
|
|
|
|
|
|
|
|
/*embark.registerContractsGeneration(function (options) {
|
|
|
|
const contractGenerations = [];
|
|
|
|
Object.keys(options.contracts).map(className => {
|
|
|
|
const contract = options.contracts[className];
|
|
|
|
const abi = JSON.stringify(contract.abiDefinition);
|
|
|
|
|
|
|
|
contractGenerations.push(`${className} = new this.web3.eth.contract('${abi}').at('${contract.deployedAddress}')`);
|
|
|
|
});
|
|
|
|
return contractGenerations.join('\n');
|
|
|
|
// return '';
|
|
|
|
});*/
|
|
|
|
|
|
|
|
embark.registerConsoleCommand((cmd) => {
|
|
|
|
if (cmd === "hello") {
|
|
|
|
return "hello there!";
|
|
|
|
}
|
|
|
|
// continue to embark or next plugin;
|
|
|
|
return false;
|
|
|
|
});
|
|
|
|
|
2017-03-16 11:31:52 +00:00
|
|
|
};
|