Permalink
Browse files

[Generator] removed Filesystem class. Propel now relies on the standa…

…lone Filesystem component of the Symfony2 framework installable via Composer.
  • Loading branch information...
1 parent 338752a commit cd2233685a3edc258dca1310ebf5ca4f0e6250ec @hhamon hhamon committed Aug 22, 2012
View
@@ -21,7 +21,8 @@
"symfony/console": "2.1.*",
"monolog/monolog": "1.0.*",
"symfony/finder": "2.1.*",
- "symfony/validator": "2.1.*"
+ "symfony/validator": "2.1.*",
+ "symfony/filesystem": "2.1.*"
},
"require-dev": {
"behat/behat": "2.4@stable"
@@ -13,7 +13,7 @@
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Finder\Finder;
-
+use Symfony\Component\Filesystem\Filesystem;
use Propel\Generator\Exception\RuntimeException;
/**
@@ -22,9 +22,10 @@
abstract class AbstractCommand extends Command
{
const DEFAULT_INPUT_DIRECTORY = '.';
-
const DEFAULT_PLATFORM = 'MysqlPlatform';
+ protected $filesystem;
+
/**
* {@inheritdoc}
*/
@@ -72,6 +73,20 @@ protected function getSchemas($directory)
);
}
+ /**
+ * Returns a Filesystem instance.
+ *
+ * @return Filesystem
+ */
+ protected function getFilesystem()
+ {
+ if (null === $this->filesystem) {
+ $this->filesystem = new Filesystem();
+ }
+
+ return $this->filesystem;
+ }
+
protected function parseConnection($connection)
{
$pos = strpos($connection, '=');
@@ -10,16 +10,14 @@
namespace Propel\Generator\Command;
-use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\XmlToArrayConverter;
use Propel\Generator\Config\ArrayToPhpConverter;
-use Propel\Generator\Util\Filesystem;
-class ConfigConvertXmlCommand extends Command
+class ConfigConvertXmlCommand extends AbstractCommand
{
const DEFAULT_INPUT_DIRECTORY = '.';
const DEFAULT_INPUT_FILE = 'runtime-conf.xml';
@@ -51,7 +49,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
throw new \RuntimeException(sprintf('Unable to find the "%s" configuration file', $inputFilePath));
}
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
if (!$filesystem->mkdir($input->getOption('output-dir'))) {
throw new \RuntimeException(sprintf('Unable to write the "%s" output directory', $input->getOption('output-dir')));
};
@@ -17,7 +17,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\ReverseManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -61,7 +60,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.reverse.parser.class' => sprintf('\\Propel\\Generator\\Reverse\\%sSchemaParser', $vendor),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new ReverseManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\GraphvizManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -49,7 +48,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.packageObjectModel' => true,
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new GraphvizManager();
@@ -18,7 +18,6 @@
use Propel\Generator\Exception\RuntimeException;
use Propel\Generator\Manager\MigrationManager;
use Propel\Generator\Model\IdMethod;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -55,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.platform.class' => $input->getOption('platform'),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new MigrationManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\MigrationManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -52,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.platform.class' => $input->getOption('platform'),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new MigrationManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\MigrationManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -52,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.platform.class' => $input->getOption('platform'),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new MigrationManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\MigrationManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -52,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.platform.class' => $input->getOption('platform'),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new MigrationManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\MigrationManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -52,7 +51,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.platform.class' => $input->getOption('platform'),
));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new MigrationManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\ModelManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author Florian Klein <florian.klein@free.fr>
@@ -133,7 +132,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.mysql.tableEngineKeyword' => 'ENGINE',
), $this->getBuildProperties($input->getOption('input-dir') . '/build.properties')));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new ModelManager();
@@ -16,7 +16,6 @@
use Symfony\Component\Console\Output\Output;
use Propel\Generator\Config\GeneratorConfig;
use Propel\Generator\Manager\SqlManager;
-use Propel\Generator\Util\Filesystem;
/**
* @author William Durand <william.durand1@gmail.com>
@@ -64,7 +63,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
'propel.mysql.tableEngineKeyword' => 'ENGINE',
), $this->getBuildProperties($input->getOption('input-dir') . '/build.properties')));
- $filesystem = new Filesystem();
+ $filesystem = $this->getFilesystem();
$filesystem->mkdir($input->getOption('output-dir'));
$manager = new SqlManager();
Oops, something went wrong. Retry.

0 comments on commit cd22336

Please sign in to comment.