Skip to content

Commit

Permalink
Implemented a temporary "no stop" setting
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchPierias committed Apr 22, 2019
1 parent 9067c4c commit fb19992
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 35 deletions.
27 changes: 10 additions & 17 deletions src/cli/lamington-build.ts
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
import { eosIsReady, startEos, runTests, stopContainer, buildAll } from './utils';
import { eosIsReady, startEos, stopContainer, buildAll } from './utils';
import { GitIgnoreManager } from '../gitignoreManager';
import { ConfigManager } from '../configManager';

const run = async () => {
if (await eosIsReady()) {
console.log('EOS is running. Stopping...');
// Initialize configuration
await ConfigManager.initWithDefaults();
// Stop container if running
if (!ConfigManager.keepAlive && await eosIsReady()) {
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...');
// Start the EOSIO container image
if (!await eosIsReady()) {
await startEos();
}
// Build all smart contracts
await buildAll();

console.log('Stopping EOS...');
await stopContainer();
};

run().catch(error => {
console.log('Stopping EOS...');
stopContainer().then(() => {
throw error;
});
Expand Down
33 changes: 15 additions & 18 deletions src/cli/lamington-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@ import { GitIgnoreManager } from '../gitignoreManager';
import { ConfigManager } from '../configManager';

const run = async () => {
if (await eosIsReady()) {
console.log('EOS is running. Stopping...');
// Initialize the configuration
await ConfigManager.initWithDefaults();
// Stop running instances when keepAlive is false
if (!ConfigManager.keepAlive && await eosIsReady()) {
await stopContainer();
}

// This initialises the config
console.log('Getting configuration...');
await ConfigManager.initWithDefaults();

// This ensures we have our .gitignore inside the .lamington directory
// Ensures we have our .gitignore inside the .lamington directory
await GitIgnoreManager.createIfMissing();

console.log('Starting EOS...');
await startEos();

console.log('Building smart contracts...');
// Start an EOSIO instance if not running
if (!await eosIsReady()) {
await startEos();
}
// Start compiling smart contracts
await buildAll();

console.log('Running tests...');
// Begin running tests
await runTests();

console.log('Stopping EOS...');
await stopContainer();
// Stop EOSIO instance if keepAlive is false
if (!ConfigManager.keepAlive) {
await stopContainer();
}
};

run().catch(error => {
Expand Down

0 comments on commit fb19992

Please sign in to comment.