Addid basic templating to start building UI from here

This commit is contained in:
Richard Ramos 2018-05-10 11:25:31 -04:00 committed by Iuri Matias
parent 36bf352827
commit b9be50fad0
1 changed files with 12 additions and 22 deletions

View File

@ -13,15 +13,6 @@ class Scaffolding {
this.frameworkPlugin = null;
}
createDirectories(contractName){
const dir = './app/' + contractName;
if (!fs.existsSync(dir)){
fs.mkdirSync(dir);
} else {
throw formatReplyMsg("directory ./app/" + contractName + " already exists");
}
}
isContract(contractName){
return this.embark.config.contractsConfig.contracts[contractName] !== undefined;
}
@ -41,21 +32,20 @@ class Scaffolding {
frameworkPlugin = plugins[0].pluginModule;
}
try {
if(!this.isContract(contractName)){
return formatReplyMsg("contract '" + contractName + "' does not exist");
}
const contract = this.embark.config.contractsConfig.contracts[contractName];
this.createDirectories(contractName);
let uiFramework = new frameworkPlugin(this.embark, this.options);
uiFramework.build(contract);
} catch(err){
return err;
if(!this.isContract(contractName)){
return errorMessage("contract '" + contractName + "' does not exist");
}
return formatReplyMsg("done!");
const contract = this.embark.config.contractsConfig.contracts[contractName];
try {
let uiFramework = new frameworkPlugin(this.embark, this.options);
let result = uiFramework.build(contract);
this.embark.logger.info(result);
} catch(err){
throw errorMessage(err);
}
}
}