Applied more improvements on InstallCommand with SymfonyStyle

This commit is contained in:
Alejandro Celaya 2017-12-31 17:52:17 +01:00
parent 4d4aafa6db
commit b289e3bac2

View File

@ -132,7 +132,7 @@ class InstallCommand extends Command
// If current command is not update, generate database // If current command is not update, generate database
if (! $this->isUpdate) { if (! $this->isUpdate) {
$this->io->writeln('Initializing database...'); $this->io->write('Initializing database...');
if (! $this->runCommand( if (! $this->runCommand(
'php vendor/bin/doctrine.php orm:schema-tool:create', 'php vendor/bin/doctrine.php orm:schema-tool:create',
'Error generating database.', 'Error generating database.',
@ -143,7 +143,7 @@ class InstallCommand extends Command
} }
// Run database migrations // Run database migrations
$this->io->writeln('Updating database...'); $this->io->write('Updating database...');
if (! $this->runCommand( if (! $this->runCommand(
'php vendor/bin/doctrine-migrations migrations:migrate', 'php vendor/bin/doctrine-migrations migrations:migrate',
'Error updating database.', 'Error updating database.',
@ -153,7 +153,7 @@ class InstallCommand extends Command
} }
// Generate proxies // Generate proxies
$this->io->writeln('Generating proxies...'); $this->io->write('Generating proxies...');
if (! $this->runCommand( if (! $this->runCommand(
'php vendor/bin/doctrine.php orm:generate-proxies', 'php vendor/bin/doctrine.php orm:generate-proxies',
'Error generating proxies.', 'Error generating proxies.',
@ -161,6 +161,8 @@ class InstallCommand extends Command
)) { )) {
return; return;
} }
$this->io->success('Installation complete!');
} }
/** /**
@ -239,7 +241,7 @@ class InstallCommand extends Command
{ {
$process = $this->processHelper->run($output, $command); $process = $this->processHelper->run($output, $command);
if ($process->isSuccessful()) { if ($process->isSuccessful()) {
$this->io->writeln(' <info>Success!</info>'); $this->io->writeln(' <info>Success!</info>');
return true; return true;
} }
@ -247,9 +249,7 @@ class InstallCommand extends Command
return false; return false;
} }
$this->io->writeln( $this->io->error($errorMessage . ' Run this command with -vvv to see specific error info.');
' <error>' . $errorMessage . '</error> Run this command with -vvv to see specific error info.'
);
return false; return false;
} }
} }