mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-02 18:34:09 +00:00
simplify buildContracts and buildWeb3JS methodsgst
This commit is contained in:
parent
4dcd644b7c
commit
8ae6c6a646
@ -179,31 +179,39 @@ class Pipeline {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildContracts(callback) {
|
buildContracts(cb) {
|
||||||
const self = this;
|
const self = this;
|
||||||
fs.mkdirp(fs.dappPath(this.buildDir, 'contracts'), (err) => {
|
|
||||||
if (err) {
|
async.waterfall([
|
||||||
return callback(err);
|
function makeDirectory(next) {
|
||||||
}
|
fs.mkdirp(fs.dappPath(self.buildDir, 'contracts'), (err, _result) => {
|
||||||
self.events.request('contracts:list', (contracts) => {
|
next(err)
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function getContracts(next) {
|
||||||
|
self.events.request('contracts:list', (contracts) => {
|
||||||
|
next(null, contracts);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
function writeContractsJSON(contracts, next) {
|
||||||
async.each(contracts, (contract, eachCb) => {
|
async.each(contracts, (contract, eachCb) => {
|
||||||
fs.writeJson(fs.dappPath(this.buildDir, 'contracts', contract.className + ".json"), contract, {spaces: 2}, eachCb);
|
fs.writeJson(fs.dappPath(self.buildDir, 'contracts', contract.className + ".json"), contract, {spaces: 2}, eachCb);
|
||||||
}, () => {callback()});
|
}, () => {next()});
|
||||||
});
|
}
|
||||||
});
|
], cb);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildWeb3JS(cb) {
|
buildWeb3JS(cb) {
|
||||||
const self = this;
|
const self = this;
|
||||||
async.waterfall([
|
async.waterfall([
|
||||||
|
function makeDirectory(next) {
|
||||||
|
fs.mkdirp(fs.dappPath(".embark"), (err, _result) => {
|
||||||
|
next(err);
|
||||||
|
});
|
||||||
|
},
|
||||||
function getWeb3Code(next) {
|
function getWeb3Code(next) {
|
||||||
self.events.request('code-generator:web3js', next);
|
self.events.request('code-generator:web3js', next);
|
||||||
},
|
},
|
||||||
function makeDirectory(code, next) {
|
|
||||||
fs.mkdirp(fs.dappPath(".embark"), (err, _result) => {
|
|
||||||
next(err, code);
|
|
||||||
});
|
|
||||||
},
|
|
||||||
function writeFile(code, next) {
|
function writeFile(code, next) {
|
||||||
fs.writeFile(fs.dappPath(".embark", 'web3_instance.js'), code, next);
|
fs.writeFile(fs.dappPath(".embark", 'web3_instance.js'), code, next);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user