[FrameworkBundle] removed the app:init command

This commit is contained in:
Fabien Potencier 2010-09-22 18:18:56 +02:00
parent d62befd67b
commit 69b538b632
28 changed files with 0 additions and 561 deletions

View File

@ -1,83 +0,0 @@
<?php
namespace Symfony\Bundle\FrameworkBundle\Command;
use Symfony\Component\Console\Command\Command as BaseCommand;
use Symfony\Component\Console\Input\InputArgument;
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 Symfony\Bundle\FrameworkBundle\Util\Filesystem;
use Symfony\Bundle\FrameworkBundle\Util\Mustache;
/*
* This file is part of the symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* Initializes a new application.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class InitApplicationCommand extends BaseCommand
{
/**
* @see Command
*/
protected function configure()
{
$this
->setDefinition(array(
new InputArgument('name', InputArgument::REQUIRED, 'The application name (Hello)'),
new InputArgument('path', InputArgument::REQUIRED, 'The path to the application (hello/)'),
new InputArgument('web_path', InputArgument::REQUIRED, 'The path to the public web root (web/)'),
new InputOption('format', '', InputOption::PARAMETER_REQUIRED, 'Use the format for configuration files (php, xml, or yaml)', 'xml'),
))
->setName('init:application')
;
}
/**
* @see Command
*/
protected function execute(InputInterface $input, OutputInterface $output)
{
if (file_exists($targetDir = $input->getArgument('path'))) {
throw new \RuntimeException(sprintf('The directory "%s" already exists.', $targetDir));
}
if (!file_exists($webDir = $input->getArgument('web_path'))) {
mkdir($webDir, 0777, true);
}
$parameters = array(
'class' => $input->getArgument('name'),
'application' => strtolower($input->getArgument('name')),
'format' => $input->getOption('format'),
);
$filesystem = new Filesystem();
$filesystem->mirror(__DIR__.'/../Resources/skeleton/application/generic', $targetDir);
$filesystem->mirror(__DIR__.'/../Resources/skeleton/application/'.$input->getOption('format'), $targetDir);
Mustache::renderDir($targetDir, $parameters);
$filesystem->chmod($targetDir.'/console', 0777);
$filesystem->chmod($targetDir.'/logs', 0777);
$filesystem->chmod($targetDir.'/cache', 0777);
$filesystem->rename($targetDir.'/Kernel.php', $targetDir.'/'.$input->getArgument('name').'Kernel.php');
$filesystem->rename($targetDir.'/Cache.php', $targetDir.'/'.$input->getArgument('name').'Cache.php');
$filesystem->copy(__DIR__.'/../Resources/skeleton/web/front_controller.php', $file = $webDir.'/'.(file_exists($webDir.'/index.php') ? strtolower($input->getArgument('name')) : 'index').'.php');
Mustache::renderFile($file, $parameters);
$filesystem->copy(__DIR__.'/../Resources/skeleton/web/front_controller_debug.php', $file = $webDir.'/'.strtolower($input->getArgument('name')).'_dev.php');
Mustache::renderFile($file, $parameters);
}
}

View File

@ -1,37 +0,0 @@
<?php
namespace Symfony\Bundle\FrameworkBundle\Console;
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Bundle\FrameworkBundle\Command\InitApplicationCommand;
/*
* This file is part of the Symfony framework.
*
* (c) Fabien Potencier <fabien.potencier@symfony-project.com>
*
* This source file is subject to the MIT license that is bundled
* with this source code in the file LICENSE.
*/
/**
* BootstrapApplication.
*
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
*/
class BootstrapApplication extends BaseApplication
{
/**
* Constructor.
*/
public function __construct()
{
parent::__construct('Symfony', Kernel::VERSION);
$this->addCommand(new InitApplicationCommand());
}
}

View File

@ -1,13 +0,0 @@
<?php
require_once __DIR__.'/{{ class }}Kernel.php';
use Symfony\Bundle\FrameworkBundle\Cache\Cache;
class {{ class }}Cache extends Cache
{
protected function getOptions()
{
return array();
}
}

View File

@ -1,52 +0,0 @@
<?php
require_once __DIR__.'/../src/autoload.php';
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\DependencyInjection\Loader\LoaderInterface;
class {{ class }}Kernel extends Kernel
{
public function registerRootDir()
{
return __DIR__;
}
public function registerBundles()
{
$bundles = array(
new Symfony\Bundle\FrameworkBundle\FrameworkBundle(),
// enable third-party bundles
new Symfony\Bundle\ZendBundle\ZendBundle(),
new Symfony\Bundle\SwiftmailerBundle\SwiftmailerBundle(),
new Symfony\Bundle\DoctrineBundle\DoctrineBundle(),
//new Symfony\Bundle\DoctrineMigrationsBundle\DoctrineMigrationsBundle(),
//new Symfony\Bundle\DoctrineMongoDBBundle\DoctrineMongoDBBundle(),
//new Symfony\Bundle\PropelBundle\PropelBundle(),
//new Symfony\Bundle\TwigBundle\TwigBundle(),
// register your bundles
);
if ($this->isDebug()) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
}
return $bundles;
}
public function registerBundleDirs()
{
return array(
'Application' => __DIR__.'/../src/Application',
'Bundle' => __DIR__.'/../src/Bundle',
'Symfony\\Bundle' => __DIR__.'/../src/vendor/Symfony/src/Symfony/Bundle',
);
}
public function registerContainerConfiguration(LoaderInterface $loader)
{
$loader->load(__DIR__.'/config/config_'.$this->getEnvironment().'.{{ format }}');
}
}

View File

@ -1,11 +0,0 @@
#!/usr/bin/env php
<?php
require_once __DIR__.'/{{ class }}Kernel.php';
use Symfony\Bundle\FrameworkBundle\Console\Application;
$kernel = new {{ class }}Kernel('dev', true);
$application = new Application($kernel);
$application->run();

View File

@ -1,29 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
backupStaticAttributes="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="true"
stopOnFailure="false"
syntaxCheck="false"
bootstrap="../src/autoload.php"
>
<testsuites>
<testsuite name="Project Test Suite">
<directory>../src/Application/*/Tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory>../src/Application</directory>
<exclude>
<directory>../src/Application/*/Resources</directory>
<directory>../src/Application/*/Tests</directory>
</exclude>
</whitelist>
</filter>
</phpunit>

View File

@ -1,48 +0,0 @@
<?php
$container->loadFromExtension('app', 'config', array(
'charset' => 'UTF-8',
'error_handler' => null,
'csrf-secret' => 'xxxxxxxxxx',
'router' => array('resource' => '%kernel.root_dir%/config/routing.php'),
'validation' => array('enabled' => true, 'annotations' => true),
'templating' => array(
'escaping' => 'htmlspecialchars'
#'assets_version' => "SomeVersionScheme",
),
#'user' => array(
# 'default_locale' => "fr",
# 'session' => array(
# 'name' => "SYMFONY",
# 'type' => "Native",
# 'lifetime' => "3600",
# )
#),
));
// Twig Configuration
/*
$container->loadFromExtension('twig', 'config', array('auto_reload' => true));
*/
// Doctrine Configuration
/*
$container->loadFromExtension('doctrine', 'dbal', array(
'dbname' => 'xxxxxxxx',
'user' => 'xxxxxxxx',
'password' => '',
));
$container->loadFromExtension('doctrine', 'orm');
*/
// Swiftmailer Configuration
/*
$container->loadFromExtension('swiftmailer', 'config', array(
'transport' => "smtp",
'encryption' => "ssl",
'auth_mode' => "login",
'host' => "smtp.gmail.com",
'username' => "xxxxxxxx",
'password' => "xxxxxxxx",
));
*/

View File

@ -1,20 +0,0 @@
<?php
$loader->import('config.php');
$container->loadFromExtension('app', 'config', array(
'router' => array('resource' => '%kernel.root_dir%/config/routing_dev.php'),
'profiler' => array('only-exceptions' => false),
));
$container->loadFromExtension('webprofiler', 'config', array(
'toolbar' => true,
'intercept-redirects' => true,
));
$container->loadFromExtension('zend', 'config', array(
'logger' => array(
'priority' => 'info',
'path' => '%kernel.logs_dir%/%kernel.environment%.log',
),
));

View File

@ -1,3 +0,0 @@
<?php
$loader->import('config.php');

View File

@ -1,17 +0,0 @@
<?php
$loader->import('config_dev.php');
$container->loadFromExtension('app', 'config', array(
'error_handler' => false,
'test' => true,
));
$container->loadFromExtension('webprofiler', 'config', array(
'toolbar' => false,
'intercept-redirects' => false,
));
$container->loadFromExtension('zend', 'config', array(
'logger' => array('priority' => 'debug'),
));

View File

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

View File

@ -1,10 +0,0 @@
<?php
use Symfony\Component\Routing\RouteCollection;
$collection = new RouteCollection();
$collection->addCollection($loader->import(__DIR__.'/routing.php'));
$collection->addCollection($loader->import("WebProfilerBundle/Resources/config/routing/profiler.xml"), '/_profiler');
return $collection;

View File

@ -1,49 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:app="http://www.symfony-project.org/schema/dic/symfony"
xmlns:doctrine="http://www.symfony-project.org/schema/dic/doctrine"
xmlns:twig="http://www.symfony-project.org/schema/dic/twig"
xmlns:swift="http://www.symfony-project.org/schema/dic/swiftmailer"
xmlns:zend="http://www.symfony-project.org/schema/dic/zend"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd
http://www.symfony-project.org/schema/dic/symfony http://www.symfony-project.org/schema/dic/symfony/symfony-1.0.xsd
http://www.symfony-project.org/schema/dic/doctrine http://www.symfony-project.org/schema/dic/doctrine/doctrine-1.0.xsd
http://www.symfony-project.org/schema/dic/zend http://www.symfony-project.org/schema/dic/zend/zend-1.0.xsd
http://www.symfony-project.org/schema/dic/twig http://www.symfony-project.org/schema/dic/twig/twig-1.0.xsd
http://www.symfony-project.org/schema/dic/swiftmailer http://www.symfony-project.org/schema/dic/swiftmailer/swiftmailer-1.0.xsd">
<app:config csrf-secret="xxxxxxxxxx" charset="UTF-8" error-handler="null">
<app:router resource="%kernel.root_dir%/config/routing.xml" />
<app:validation enabled="true" annotations="true" />
<app:templating escaping="htmlspecialchars" />
<!--
<app:user default-locale="fr">
<app:session name="SYMFONY" type="Native" lifetime="3600" />
</app:user>
//-->
</app:config>
<!-- Twig Configuration -->
<!--
<twig:config auto_reload="true" />
-->
<!-- Doctrine Configuration -->
<!--
<doctrine:dbal dbname="xxxxxxxx" user="xxxxxxxx" password="" />
<doctrine:orm />
-->
<!-- Swiftmailer Configuration -->
<!--
<swiftmailer:config
transport="smtp"
encryption="ssl"
auth_mode="login"
host="smtp.gmail.com"
username="xxxxxxxx"
password="xxxxxxxx" />
-->
</container>

View File

@ -1,29 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zend="http://www.symfony-project.org/schema/dic/zend"
xmlns:app="http://www.symfony-project.org/schema/dic/symfony"
xmlns:webprofiler="http://www.symfony-project.org/schema/dic/webprofiler"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd
http://www.symfony-project.org/schema/dic/webprofiler http://www.symfony-project.org/schema/dic/webprofiler/webprofiler-1.0.xsd
http://www.symfony-project.org/schema/dic/zend http://www.symfony-project.org/schema/dic/zend/zend-1.0.xsd">
<imports>
<import resource="config.xml" />
</imports>
<app:config>
<app:router resource="%kernel.root_dir%/config/routing_dev.xml" />
<app:profiler only-exceptions="false" />
</app:config>
<webprofiler:config
toolbar="true"
intercept-redirects="true"
/>
<zend:config>
<zend:logger priority="info" path="%kernel.logs_dir%/%kernel.environment%.log" />
</zend:config>
</container>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd">
<imports>
<import resource="config.xml" />
</imports>
</container>

View File

@ -1,26 +0,0 @@
<?xml version="1.0" ?>
<container xmlns="http://www.symfony-project.org/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:zend="http://www.symfony-project.org/schema/dic/zend"
xmlns:app="http://www.symfony-project.org/schema/dic/symfony"
xsi:schemaLocation="http://www.symfony-project.org/schema/dic/services http://www.symfony-project.org/schema/dic/services/services-1.0.xsd
http://www.symfony-project.org/schema/dic/zend http://www.symfony-project.org/schema/dic/zend/zend-1.0.xsd">
<imports>
<import resource="config_dev.xml" />
</imports>
<webprofiler:config
toolbar="false"
intercept-redirects="false"
/>
<app:config error_handler="false">
<app:test />
</app:config>
<zend:config>
<zend:logger priority="debug" />
</zend:config>
</container>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://www.symfony-project.org/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
<route id="homepage" pattern="/">
<default key="_controller">FrameworkBundle:Default:index</default>
</route>
</routes>

View File

@ -1,10 +0,0 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://www.symfony-project.org/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.symfony-project.org/schema/routing http://www.symfony-project.org/schema/routing/routing-1.0.xsd">
<import resource="routing.xml" />
<import resource="WebProfilerBundle/Resources/config/routing/profiler.xml" prefix="/_profiler" />
</routes>

View File

@ -1,35 +0,0 @@
app.config:
charset: UTF-8
error_handler: null
csrf_secret: xxxxxxxxxx
router: { resource: "%kernel.root_dir%/config/routing.yml" }
validation: { enabled: true, annotations: true }
templating:
escaping: htmlspecialchars
#assets_version: SomeVersionScheme
#user:
# default_locale: fr
# session:
# name: SYMFONY
# type: Native
# lifetime: 3600
## Twig Configuration
#twig.config:
# auto_reload: true
## Doctrine Configuration
#doctrine.dbal:
# dbname: xxxxxxxx
# user: xxxxxxxx
# password: ~
#doctrine.orm: ~
## Swiftmailer Configuration
#swiftmailer.config:
# transport: smtp
# encryption: ssl
# auth_mode: login
# host: smtp.gmail.com
# username: xxxxxxxx
# password: xxxxxxxx

View File

@ -1,15 +0,0 @@
imports:
- { resource: config.yml }
app.config:
router: { resource: "%kernel.root_dir%/config/routing_dev.yml" }
profiler: { only_exceptions: false }
webprofiler.config:
toolbar: true
intercept_redirects: true
zend.config:
logger:
priority: debug
path: %kernel.root_dir%/logs/%kernel.environment%.log

View File

@ -1,2 +0,0 @@
imports:
- { resource: config.yml }

View File

@ -1,14 +0,0 @@
imports:
- { resource: config_dev.yml }
app.config:
error_handler: false
test: ~
webprofiler.config:
toolbar: false
intercept_redirects: false
zend.config:
logger:
priority: debug

View File

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

View File

@ -1,6 +0,0 @@
_main:
resource: routing.yml
_profiler:
resource: WebProfilerBundle/Resources/config/routing/profiler.xml
prefix: /_profiler

View File

@ -1,6 +0,0 @@
<?php
require_once __DIR__.'/../{{ application }}/{{ class }}Kernel.php';
$kernel = new {{ class }}Kernel('prod', false);
$kernel->handle()->send();

View File

@ -1,12 +0,0 @@
<?php
// this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it, or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'))) {
die('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
require_once __DIR__.'/../{{ application }}/{{ class }}Kernel.php';
$kernel = new {{ class }}Kernel('dev', true);
$kernel->handle()->send();