[FrameworkBundle] added --format=xml,php,yml optional parameter to the init:bundle command

* Added the --format parameter to the InitBundleCommand.php file
* Moved all the non-format-dependent files from Resources/skeleton/bundle to Resources/skeleton/bundle/generic
* Created Resources/skeleton/bundle/[php,yml,xml] subfolders containing the files config/routing.[xml,yml,php]
This commit is contained in:
Fabrice Bernhard 2011-02-08 01:05:42 +01:00
parent 7173764dc1
commit 13469a2d82
9 changed files with 18 additions and 1 deletions

View File

@ -35,6 +35,7 @@ class InitBundleCommand extends Command
new InputArgument('namespace', InputArgument::REQUIRED, 'The namespace of the bundle to create'), new InputArgument('namespace', InputArgument::REQUIRED, 'The namespace of the bundle to create'),
new InputArgument('dir', InputArgument::REQUIRED, 'The directory where to create the bundle'), new InputArgument('dir', InputArgument::REQUIRED, 'The directory where to create the bundle'),
new InputArgument('bundleName', InputArgument::OPTIONAL, 'The optional bundle name'), new InputArgument('bundleName', InputArgument::OPTIONAL, 'The optional bundle name'),
new InputOption('format', '', InputOption::VALUE_REQUIRED, 'Use the format for configuration files (php, xml, or yml)', 'xml')
)) ))
->setHelp(<<<EOT ->setHelp(<<<EOT
The <info>init:bundle</info> command generates a new bundle with a basic skeleton. The <info>init:bundle</info> command generates a new bundle with a basic skeleton.
@ -93,7 +94,8 @@ EOT
} }
$filesystem = $this->container->get('filesystem'); $filesystem = $this->container->get('filesystem');
$filesystem->mirror(__DIR__.'/../Resources/skeleton/bundle', $targetDir); $filesystem->mirror(__DIR__.'/../Resources/skeleton/bundle/generic', $targetDir);
$filesystem->mirror(__DIR__.'/../Resources/skeleton/bundle/'.$input->getOption('format'), $targetDir);
Mustache::renderDir($targetDir, array( Mustache::renderDir($targetDir, array(
'namespace' => $namespace, 'namespace' => $namespace,

View File

@ -0,0 +1,12 @@
<?php
use Symfony\Component\Routing\RouteCollection;
use Symfony\Component\Routing\Route;
$collection = new RouteCollection();
/*
$collection->add('homepage', new Route('/', array(
'_controller' => 'NewBundle:Default:index',
)));
*/
return $collection;

View File

@ -0,0 +1,3 @@
#homepage:
# pattern: /
# defaults: { _controller: NewBundle:Default:index }