mirror of
https://github.com/status-im/embark-area-51.git
synced 2025-02-08 21:34:55 +00:00
async buildContracts
This commit is contained in:
parent
2dd9e8f2ea
commit
4ec7fbb9db
@ -53,6 +53,10 @@ function writeJSONSync() {
|
||||
return fs.writeJSONSync.apply(fs.writeJSONSync, arguments);
|
||||
}
|
||||
|
||||
function writeJson() {
|
||||
return fs.writeJson.apply(fs.writeJson, arguments);
|
||||
}
|
||||
|
||||
function existsSync() {
|
||||
return fs.existsSync.apply(fs.existsSync, arguments);
|
||||
}
|
||||
@ -89,6 +93,7 @@ module.exports = {
|
||||
writeFile,
|
||||
writeFileSync,
|
||||
readJSONSync,
|
||||
writeJson,
|
||||
writeJSONSync,
|
||||
access,
|
||||
existsSync,
|
||||
|
@ -53,16 +53,16 @@ class Pipeline {
|
||||
|
||||
build(abi, contractsJSON, path, callback) {
|
||||
let self = this;
|
||||
const importsList = {};
|
||||
|
||||
this.buildContracts(contractsJSON);
|
||||
|
||||
self.buildWeb3JS(function (err) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
let importsList = {};
|
||||
|
||||
async.waterfall([
|
||||
function buildTheContracts(next) {
|
||||
self.buildContracts(contractsJSON, next);
|
||||
},
|
||||
function buildWeb3(next) {
|
||||
self.buildWeb3JS(next);
|
||||
},
|
||||
function createImportList(next) {
|
||||
importsList["Embark/EmbarkJS"] = fs.dappPath(".embark", 'embark.js');
|
||||
importsList["Embark/web3"] = fs.dappPath(".embark", 'web3_instance.js');
|
||||
|
||||
@ -71,7 +71,8 @@ class Pipeline {
|
||||
importsList[importName] = importLocation;
|
||||
});
|
||||
|
||||
async.waterfall([
|
||||
next();
|
||||
},
|
||||
function writeContracts(next) {
|
||||
async.each(Object.keys(contractsJSON), (contractName, eachCb) => {
|
||||
let contractCode = self.buildContractJS(contractName);
|
||||
@ -192,7 +193,6 @@ class Pipeline {
|
||||
next);
|
||||
}
|
||||
], callback);
|
||||
});
|
||||
}
|
||||
|
||||
runPlugins(file, fileContent, fileCb) {
|
||||
@ -298,13 +298,16 @@ class Pipeline {
|
||||
});
|
||||
}
|
||||
|
||||
buildContracts(contractsJSON) {
|
||||
fs.mkdirpSync(fs.dappPath(this.buildDir, 'contracts'));
|
||||
|
||||
for (let className in contractsJSON) {
|
||||
let contract = contractsJSON[className];
|
||||
fs.writeJSONSync(fs.dappPath(this.buildDir, 'contracts', className + ".json"), contract, {spaces: 2});
|
||||
buildContracts(contractsJSON, callback) {
|
||||
fs.mkdirp(fs.dappPath(this.buildDir, 'contracts'), (err) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
async.each(Object.keys(contractsJSON), (className, eachCb) => {
|
||||
let contract = contractsJSON[className];
|
||||
fs.writeJson(fs.dappPath(this.buildDir, 'contracts', className + ".json"), contract, {spaces: 2}, eachCb);
|
||||
}, callback);
|
||||
});
|
||||
}
|
||||
|
||||
buildContractJS(contractName) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user