Changes based on code review

- Style changes for not requiring "else" in handlebar helpers
- Changed build to async
This commit is contained in:
Richard Ramos 2018-05-15 16:19:39 -04:00 committed by Pascal Precht
parent 2c18caf481
commit fdb2d4aed3
No known key found for this signature in database
GPG Key ID: 0EE28D8D6FD85D7D
2 changed files with 9 additions and 14 deletions

View File

@ -34,8 +34,7 @@ class Scaffolding {
}
const contract = contractConfiguration.contracts[contractName];
const result = build(contract);
this.embark.logger.info(result);
build(contract);
}
}

View File

@ -10,25 +10,22 @@ Handlebars.registerHelper('ifview', function(stateMutability, options) {
let result = stateMutability == 'view' || stateMutability == 'pure' || stateMutability == 'constant';
if (result) {
return options.fn(this);
} else {
return options.inverse(this);
}
}
return options.inverse(this);
});
Handlebars.registerHelper('ifeq', function(elem, value, options){
if (elem == value) {
return options.fn(this);
} else {
return options.inverse(this);
}
return options.inverse(this);
});
Handlebars.registerHelper('iflengthgt', function(arr, val, options) {
if (arr.length > val) {
return options.fn(this);
} else {
return options.inverse(this);
}
}
return options.inverse(this);
});
Handlebars.registerHelper('emptyname', function(name, index) {
@ -40,9 +37,8 @@ Handlebars.registerHelper('methodname', function(abiDefinition, functionName, in
let funCount = abiDefinition.filter(x => x.name == functionName).length;
if(funCount == 1){
return '.' + functionName;
} else {
return new Handlebars.SafeString(`['${functionName}(${inputs !== null ? inputs.map(input => input.type).join(',') : '' })']`);
}
return new Handlebars.SafeString(`['${functionName}(${inputs !== null ? inputs.map(input => input.type).join(',') : ''})']`);
});
class ScaffoldingReact {
@ -78,7 +74,7 @@ class ScaffoldingReact {
});
}
build(contract){
async build(contract){
this._buildHTML(contract);
const filename = contract.className.toLowerCase();
@ -98,7 +94,7 @@ class ScaffoldingReact {
fs.writeFileSync("./embark.json", JSON.stringify(embarkJson, null, 4));
return filename + ".html generated";
this.embark.logger.info(filename + ".html generated");
}
}