From ed1d9ad267fbab5e422db4aaa14e8b8e96f03160 Mon Sep 17 00:00:00 2001 From: William DURAND Date: Wed, 13 Apr 2011 22:27:07 +0200 Subject: [PATCH] Improved some commands --- Command/BuildModelCommand.php | 2 +- Command/MigrationGenerateDiffCommand.php | 13 +++++++++++++ Command/MigrationMigrateCommand.php | 9 +++++++++ Command/MigrationStatusCommand.php | 13 +++++++++++++ Command/PhingCommand.php | 3 ++- 5 files changed, 38 insertions(+), 2 deletions(-) diff --git a/Command/BuildModelCommand.php b/Command/BuildModelCommand.php index 13fadf1..42d449a 100644 --- a/Command/BuildModelCommand.php +++ b/Command/BuildModelCommand.php @@ -50,7 +50,7 @@ EOT $this->callPhing('om'); foreach ($this->tempSchemas as $schemaFile => $schemaDetails) { - $output->writeln(sprintf('Built model classes for bundle "%s"', $schemaDetails['bundle'])); + $output->writeln(sprintf('Built Model classes for bundle "%s" from "%s"', $schemaDetails['bundle'], $schemaDetails['path'])); } } } diff --git a/Command/MigrationGenerateDiffCommand.php b/Command/MigrationGenerateDiffCommand.php index f195f7b..5410b8b 100644 --- a/Command/MigrationGenerateDiffCommand.php +++ b/Command/MigrationGenerateDiffCommand.php @@ -47,5 +47,18 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { $this->callPhing('diff'); + + foreach (explode("\n", $this->buffer) as $line) { + if (false !== strpos($line, '[propel-sql-diff]')) { + $arr = preg_split('#\[propel-sql-diff\] #', $line); + $info = $arr[1]; + + if ('"' === $info[0]) { + $info = sprintf('%s', $info); + } + + $output->writeln($info); + } + } } } diff --git a/Command/MigrationMigrateCommand.php b/Command/MigrationMigrateCommand.php index a4ac65d..1a80e32 100644 --- a/Command/MigrationMigrateCommand.php +++ b/Command/MigrationMigrateCommand.php @@ -67,5 +67,14 @@ EOT } else { $this->callPhing('migrate'); } + + foreach (explode("\n", $this->buffer) as $line) { + if (false !== strpos($line, '[propel-migration]')) { + $arr = preg_split('#\[propel-migration\] #', $line); + $info = $arr[1]; + + $output->writeln($info); + } + } } } diff --git a/Command/MigrationStatusCommand.php b/Command/MigrationStatusCommand.php index 821de3d..d98f2dd 100644 --- a/Command/MigrationStatusCommand.php +++ b/Command/MigrationStatusCommand.php @@ -47,5 +47,18 @@ EOT protected function execute(InputInterface $input, OutputInterface $output) { $this->callPhing('status'); + + foreach (explode("\n", $this->buffer) as $line) { + if (false !== strpos($line, '[propel-migration-status]')) { + $arr = preg_split('#\[propel-migration-status\] #', $line); + $info = $arr[1]; + + if (' ' === $info[0]) { + $info = sprintf('%s', $info); + } + + $output->writeln($info); + } + } } } diff --git a/Command/PhingCommand.php b/Command/PhingCommand.php index f1ce8b8..60a689c 100644 --- a/Command/PhingCommand.php +++ b/Command/PhingCommand.php @@ -31,7 +31,7 @@ abstract class PhingCommand extends Command protected $additionalPhingArgs = array(); protected $tempSchemas = array(); protected $tmpDir = null; - protected $debug; + protected $buffer = null; protected function callPhing($taskName, $properties = array()) { @@ -141,6 +141,7 @@ abstract class PhingCommand extends Command $m->runBuild(); if ($bufferPhingOutput) { + $this->buffer = ob_get_contents(); ob_end_clean(); }