Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[Command] Use new commands in the 'test:prepare'

  • Loading branch information...
commit 17cdf1b8ac01ea95c6d4f60108f5510e1a298a51 1 parent a90cbbf
@willdurand willdurand authored
View
6 src/Propel/Generator/Command/ModelBuild.php
@@ -122,8 +122,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$manager->setGeneratorConfig($generatorConfig);
$manager->setSchemas($files);
- $manager->setLoggerClosure(function($message) use ($output) {
- $output->writeln($message);
+ $manager->setLoggerClosure(function($message) use ($input, $output) {
+ if ($input->getOption('verbose')) {
+ $output->writeln($message);
+ }
});
$manager->setWorkingDirectory($input->getOption('output-dir'));
View
6 src/Propel/Generator/Command/SqlBuild.php
@@ -85,8 +85,10 @@ protected function execute(InputInterface $input, OutputInterface $output)
$manager->setValidate($input->getOption('validate'));
$manager->setGeneratorConfig($generatorConfig);
$manager->setSchemas($files);
- $manager->setLoggerClosure(function($message) use ($output) {
- $output->writeln($message);
+ $manager->setLoggerClosure(function($message) use ($input, $output) {
+ if ($input->getOption('verbose')) {
+ $output->writeln($message);
+ }
});
$manager->setWorkingDirectory($input->getOption('output-dir'));
View
31 src/Propel/Generator/Command/TestPrepare.php
@@ -2,6 +2,7 @@
namespace Propel\Generator\Command;
+use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
@@ -89,7 +90,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->buildFixtures($fixturesDir, $input, $output);
} else {
foreach ($this->fixturesDirs as $fixturesDir) {
- $this->buildFixtures($this->root.'/tests/Fixtures/'.$fixturesDir, $input, $output);
+ $this->buildFixtures('tests/Fixtures/'.$fixturesDir, $input, $output);
}
}
}
@@ -105,12 +106,11 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
return;
}
- $output->write(sprintf('Building fixtures in <info>%s</info>... ', $fixturesDir));
+ $output->write(sprintf('Building fixtures in <info>%-40s</info> ', $fixturesDir));
chdir($fixturesDir);
$distributionFiles = array(
- 'build.properties.dist' => 'build.properties',
'runtime-conf.xml.dist' => 'runtime-conf.xml',
);
@@ -132,12 +132,33 @@ protected function buildFixtures($fixturesDir, InputInterface $input, OutputInte
}
if (is_file('schema.xml')) {
- shell_exec(sprintf('"%s" main', $this->propelgen));
+ shell_exec(sprintf('"%s" convert-conf', $this->propelgen));
+
+ // use new commands
+ $in = new ArrayInput(array(
+ 'command' => 'sql:build',
+ '--input-dir' => '.',
+ '--output-dir' => 'build/sql/',
+ '--platform' => ucfirst($input->getOption('vendor')) . 'Platform',
+ ));
+
+ $command = $this->getApplication()->find('sql:build');
+ $command->run($in, $output);
+
+ $in = new ArrayInput(array(
+ 'command' => 'model:build',
+ '--input-dir' => '.',
+ '--output-dir' => 'build/classes/',
+ '--platform' => ucfirst($input->getOption('vendor')) . 'Platform',
+ ));
+
+ $command = $this->getApplication()->find('model:build');
+ $command->run($in, $output);
}
shell_exec(sprintf('"%s" insert-sql', $this->propelgen));
- $output->writeln('done.');
+ $output->writeln('OK');
chdir($this->root);
}
Please sign in to comment.
Something went wrong with that request. Please try again.