This commit is contained in:
Romain Neutron
2012-04-26 00:55:53 +02:00
parent edbfff226e
commit ade22295ad
631 changed files with 92375 additions and 101763 deletions

View File

@@ -37,22 +37,21 @@ class module_console_systemTemplateGenerator extends Command
public function execute(InputInterface $input, OutputInterface $output)
{
$tplDirs = array(
realpath(__DIR__ . '/../../../../templates/web/'),
realpath(__DIR__ . '/../../../../templates/mobile/')
realpath(__DIR__ . '/../../../../templates/web/'),
realpath(__DIR__ . '/../../../../templates/mobile/')
);
$n_ok = $n_error = 0;
$n_ok = $n_error = 0;
foreach ($tplDirs as $tplDir)
{
foreach ($tplDirs as $tplDir) {
$tmpDir = __DIR__ . '/../../../../tmp/cache_twig/';
$loader = new Twig_Loader_Filesystem($tplDir);
$twig = new Twig_Environment($loader, array(
'cache' => $tmpDir,
'auto_reload' => true
));
'cache' => $tmpDir,
'auto_reload' => true
));
$twig->addExtension(new Twig_Extensions_Extension_I18n());
@@ -93,16 +92,12 @@ class module_console_systemTemplateGenerator extends Command
$finder = new Symfony\Component\Finder\Finder();
foreach ($finder->files()->in(array($tplDir)) as $file)
{
try
{
foreach ($finder->files()->in(array($tplDir)) as $file) {
try {
$twig->loadTemplate(str_replace($tplDir, '', $file->getPathname()));
$output->writeln('' . $file . '');
$n_ok ++;
}
catch (Exception $e)
{
} catch (Exception $e) {
$output->writeln('<error>' . $e->getMessage() . '</error>');
$n_error ++;
}
@@ -112,8 +107,7 @@ class module_console_systemTemplateGenerator extends Command
$output->writeln("");
$output->write(sprintf('%d templates generated. ', $n_ok));
if ($n_error > 0)
{
if ($n_error > 0) {
$output->write(sprintf('<error>%d templates failed.</error>', $n_error));
}
@@ -121,5 +115,4 @@ class module_console_systemTemplateGenerator extends Command
return $n_error;
}
}