From b9be50fad01581c908c7aeb36ca22a989b8649f8 Mon Sep 17 00:00:00 2001 From: Richard Ramos Date: Thu, 10 May 2018 11:25:31 -0400 Subject: [PATCH] Addid basic templating to start building UI from here --- lib/modules/scaffolding/index.js | 34 +++++++++++--------------------- 1 file changed, 12 insertions(+), 22 deletions(-) diff --git a/lib/modules/scaffolding/index.js b/lib/modules/scaffolding/index.js index 09643167..3f40fbac 100644 --- a/lib/modules/scaffolding/index.js +++ b/lib/modules/scaffolding/index.js @@ -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); + } } }