From c3132e152e6382fc14364cfb86d1f93bbe3f42ee Mon Sep 17 00:00:00 2001 From: Kevin Brown Date: Tue, 16 Apr 2019 17:24:21 +1000 Subject: [PATCH] Build command now acts like test command but without the testing. --- src/cli/lamington-build.ts | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/src/cli/lamington-build.ts b/src/cli/lamington-build.ts index 63450d3..9915b2b 100644 --- a/src/cli/lamington-build.ts +++ b/src/cli/lamington-build.ts @@ -1,5 +1,33 @@ -import { buildAll } from './utils'; +import { eosIsReady, startEos, runTests, stopContainer, buildAll } from './utils'; +import { GitIgnoreManager } from '../gitignoreManager'; +import { ConfigManager } from '../configManager'; -buildAll().catch(error => { - throw error; +const run = async () => { + if (await eosIsReady()) { + console.log('EOS is running. Stopping...'); + await stopContainer(); + } + + // This initialises the config + console.log('Getting configuration...'); + await ConfigManager.initWithDefaults(); + + // This ensures we have our .gitignore inside the .lamington directory + await GitIgnoreManager.createIfMissing(); + + console.log('Starting EOS...'); + await startEos(); + + console.log('Building smart contracts...'); + await buildAll(); + + console.log('Stopping EOS...'); + await stopContainer(); +}; + +run().catch(error => { + console.log('Stopping EOS...'); + stopContainer().then(() => { + throw error; + }); });