mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-26 22:20:38 +00:00
add event and API endpoint to get the contract sourcecode
This commit is contained in:
parent
23bd2c91a7
commit
4f51a3cf84
@ -21,6 +21,24 @@ class Pipeline {
|
||||
|
||||
this.events.setCommandHandler('pipeline:build', (options, callback) => this.build(options, callback));
|
||||
fs.removeSync(this.buildDir);
|
||||
|
||||
const self = this;
|
||||
self.events.setCommandHandler("files:contract", (filename, cb) => {
|
||||
let file = self.contractsFiles.find((file) => file.filename === filename);
|
||||
if (!file) {
|
||||
return cb({error: filename + " not found"});
|
||||
}
|
||||
file.content(cb);
|
||||
});
|
||||
|
||||
let plugin = this.plugins.createPlugin('deployment', {});
|
||||
plugin.registerAPICall(
|
||||
'get',
|
||||
'/embark/files/contracts/',
|
||||
(req, res) => {
|
||||
self.events.request('files:contract', req.query.filename, res.send.bind(res));
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
build({modifiedAssets}, callback) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user