Initial commit with Symfony 2.1+Vendors

Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
Polonkai Gergely
2012-07-01 09:52:20 +02:00
commit 082a0130c2
5381 changed files with 416709 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Composer;
use Symfony\Component\ClassLoader\ClassCollectionLoader;
use Symfony\Component\Process\Process;
use Symfony\Component\Process\PhpExecutableFinder;
/**
* @author Jordi Boggiano <j.boggiano@seld.be>
*/
class ScriptHandler
{
public static function buildBootstrap($event)
{
$options = self::getOptions($event);
$appDir = $options['symfony-app-dir'];
if (!is_dir($appDir)) {
echo 'The symfony-app-dir ('.$appDir.') specified in composer.json was not found in '.getcwd().', can not build bootstrap file.'.PHP_EOL;
return;
}
static::executeBuildBootstrap($appDir);
}
public static function clearCache($event)
{
$options = self::getOptions($event);
$appDir = $options['symfony-app-dir'];
if (!is_dir($appDir)) {
echo 'The symfony-app-dir ('.$appDir.') specified in composer.json was not found in '.getcwd().', can not clear the cache.'.PHP_EOL;
return;
}
static::executeCommand($event, $appDir, 'cache:clear --no-warmup');
}
public static function installAssets($event)
{
$options = self::getOptions($event);
$appDir = $options['symfony-app-dir'];
$webDir = $options['symfony-web-dir'];
$symlink = '';
if ($options['symfony-assets-install'] == 'symlink') {
$symlink = '--symlink ';
} elseif ($options['symfony-assets-install'] == 'relative') {
$symlink = '--symlink --relative ';
}
if (!is_dir($webDir)) {
echo 'The symfony-web-dir ('.$webDir.') specified in composer.json was not found in '.getcwd().', can not install assets.'.PHP_EOL;
return;
}
static::executeCommand($event, $appDir, 'assets:install '.$symlink.escapeshellarg($webDir));
}
public static function doBuildBootstrap($appDir)
{
$file = $appDir.'/bootstrap.php.cache';
if (file_exists($file)) {
unlink($file);
}
ClassCollectionLoader::load(array(
'Symfony\\Component\\DependencyInjection\\ContainerAwareInterface',
// Cannot be included because annotations will parse the big compiled class file
//'Symfony\\Component\\DependencyInjection\\ContainerAware',
'Symfony\\Component\\DependencyInjection\\ContainerInterface',
'Symfony\\Component\\DependencyInjection\\Container',
'Symfony\\Component\\HttpKernel\\HttpKernelInterface',
'Symfony\\Component\\HttpKernel\\KernelInterface',
'Symfony\\Component\\HttpKernel\\Kernel',
'Symfony\\Component\\ClassLoader\\ClassCollectionLoader',
'Symfony\\Component\\ClassLoader\\ApcClassLoader',
'Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface',
'Symfony\\Component\\HttpKernel\\Bundle\\Bundle',
'Symfony\\Component\\Config\\ConfigCache',
// cannot be included as commands are discovered based on the path to this class via Reflection
//'Symfony\\Bundle\\FrameworkBundle\\FrameworkBundle',
), dirname($file), basename($file, '.php.cache'), false, false, '.php.cache');
file_put_contents($file, sprintf("<?php
namespace { \$loader = require_once __DIR__.'/autoload.php'; }
%s
namespace { return \$loader; }
", substr(file_get_contents($file), 5)));
}
protected static function executeCommand($event, $appDir, $cmd)
{
$phpFinder = new PhpExecutableFinder;
$php = escapeshellarg($phpFinder->find());
$console = escapeshellarg($appDir.'/console');
if ($event->getIO()->isDecorated()) {
$console.= ' --ansi';
}
$process = new Process($php.' '.$console.' '.$cmd);
$process->run(function ($type, $buffer) { echo $buffer; });
}
protected static function executeBuildBootstrap($appDir)
{
$phpFinder = new PhpExecutableFinder;
$php = escapeshellarg($phpFinder->find());
$cmd = escapeshellarg(__DIR__.'/../Resources/bin/build_bootstrap.php');
$appDir = escapeshellarg($appDir);
$process = new Process($php.' '.$cmd.' '.$appDir);
$process->run(function ($type, $buffer) { echo $buffer; });
}
protected static function getOptions($event)
{
$options = array_merge(array(
'symfony-app-dir' => 'app',
'symfony-web-dir' => 'web',
'symfony-assets-install' => 'hard'
), $event->getComposer()->getPackage()->getExtra());
$options['symfony-assets-install'] = getenv('SYMFONY_ASSETS_INSTALL') ?: $options['symfony-assets-install'];
return $options;
}
}

View File

@@ -0,0 +1,186 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator;
use Sensio\Bundle\DistributionBundle\Configurator\Step\StepInterface;
use Symfony\Component\Yaml\Yaml;
/**
* Configurator.
*
* @author Marc Weistroff <marc.weistroff@gmail.com>
*/
class Configurator
{
protected $filename;
protected $steps;
protected $parameters;
public function __construct($kernelDir)
{
$this->kernelDir = $kernelDir;
$this->filename = $kernelDir.'/config/parameters.yml';
$this->steps = array();
$this->parameters = $this->read();
}
public function isFileWritable()
{
return is_writable($this->filename);
}
public function clean()
{
if (file_exists($this->getCacheFilename())) {
@unlink($this->getCacheFilename());
}
}
/**
* @param StepInterface $step
*/
public function addStep(StepInterface $step)
{
$this->steps[] = $step;
}
/**
* @param integer $index
*
* @return StepInterface
*/
public function getStep($index)
{
if (isset($this->steps[$index])) {
return $this->steps[$index];
}
}
/**
* @return array
*/
public function getSteps()
{
return $this->steps;
}
/**
* @return array
*/
public function getParameters()
{
return $this->parameters;
}
/**
* @return integer
*/
public function getStepCount()
{
return count($this->steps);
}
/**
* @param array $parameters
*/
public function mergeParameters($parameters)
{
$this->parameters = array_merge($this->parameters, $parameters);
}
/**
* @return array
*/
public function getRequirements()
{
$majors = array();
foreach ($this->steps as $step) {
foreach ($step->checkRequirements() as $major) {
$majors[] = $major;
}
}
return $majors;
}
/**
* @return array
*/
public function getOptionalSettings()
{
$minors = array();
foreach ($this->steps as $step) {
foreach ($step->checkOptionalSettings() as $minor) {
$minors[] = $minor;
}
}
return $minors;
}
/**
* Renders parameters as a string.
*
* @return string
*/
public function render()
{
return Yaml::dump(array('parameters' => $this->parameters));
}
/**
* Writes parameters to parameters.yml or temporary in the cache directory.
*
* @return boolean
*/
public function write()
{
$filename = $this->isFileWritable() ? $this->filename : $this->getCacheFilename();
return file_put_contents($filename, $this->render());
}
/**
* Reads parameters from file.
*
* @return array
*/
protected function read()
{
$filename = $this->filename;
if (!$this->isFileWritable() && file_exists($this->getCacheFilename())) {
$filename = $this->getCacheFilename();
}
$ret = Yaml::parse($filename);
if (false === $ret || array() === $ret) {
throw new \InvalidArgumentException(sprintf('The %s file is not valid.', $filename));
}
if (isset($ret['parameters']) && is_array($ret['parameters'])) {
return $ret['parameters'];
} else {
return array();
}
}
/**
* getCacheFilename
*
* @return string
*/
protected function getCacheFilename()
{
return $this->kernelDir.'/cache/parameters.yml';
}
}

View File

@@ -0,0 +1,47 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator\Form;
use Sensio\Bundle\DistributionBundle\Configurator\Step\DoctrineStep;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Doctrine Form Type.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DoctrineStepType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
->add('driver', 'choice', array('choices' => DoctrineStep::getDrivers()))
->add('name', 'text')
->add('host', 'text')
->add('port', 'text', array('required' => false))
->add('user', 'text')
->add('password', 'repeated', array(
'required' => false,
'type' => 'password',
'first_name' => 'password',
'second_name' => 'password_again',
'invalid_message' => 'The password fields must match.',
))
;
}
public function getName()
{
return 'distributionbundle_doctrine_step';
}
}

View File

@@ -0,0 +1,33 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator\Form;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
/**
* Secret Form Type.
*
* @author Marc Weistroff <marc.weistroff@sensio.com>
*/
class SecretStepType extends AbstractType
{
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('secret', 'text');
}
public function getName()
{
return 'distributionbundle_secret_step';
}
}

View File

@@ -0,0 +1,143 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator\Step;
use Sensio\Bundle\DistributionBundle\Configurator\Form\DoctrineStepType;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Doctrine Step.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class DoctrineStep implements StepInterface
{
/**
* @Assert\Choice(callback="getDriverKeys")
*/
public $driver;
/**
* @Assert\NotBlank
*/
public $host;
/**
* @Assert\Min(0)
*/
public $port;
/**
* @Assert\NotBlank
*/
public $name;
/**
* @Assert\NotBlank
*/
public $user;
public $password;
public function __construct(array $parameters)
{
foreach ($parameters as $key => $value) {
if (0 === strpos($key, 'database_')) {
$parameters[substr($key, 9)] = $value;
$key = substr($key, 9);
$this->$key = $value;
}
}
}
/**
* @see StepInterface
*/
public function getFormType()
{
return new DoctrineStepType();
}
/**
* @see StepInterface
*/
public function checkRequirements()
{
$messages = array();
if (!class_exists('\PDO')) {
$messages[] = 'PDO extension is mandatory.';
} else {
$drivers = \PDO::getAvailableDrivers();
if (0 == count($drivers)) {
$messages[] = 'Please install PDO drivers.';
}
}
return $messages;
}
/**
* @see StepInterface
*/
public function checkOptionalSettings()
{
return array();
}
/**
* @see StepInterface
*/
public function update(StepInterface $data)
{
$parameters = array();
foreach ($data as $key => $value) {
$parameters['database_'.$key] = $value;
}
return $parameters;
}
/**
* @see StepInterface
*/
public function getTemplate()
{
return 'SensioDistributionBundle:Configurator/Step:doctrine.html.twig';
}
/**
* @return array
*/
static public function getDriverKeys()
{
return array_keys(static::getDrivers());
}
/**
* @return array
*/
static public function getDrivers()
{
return array(
'pdo_mysql' => 'MySQL (PDO)',
'pdo_sqlite' => 'SQLite (PDO)',
'pdo_pgsql' => 'PosgreSQL (PDO)',
'oci8' => 'Oracle (native)',
'ibm_db2' => 'IBM DB2 (native)',
'pdo_oci' => 'Oracle (PDO)',
'pdo_ibm' => 'IBM DB2 (PDO)',
'pdo_sqlsrv' => 'SQLServer (PDO)',
);
}
}

View File

@@ -0,0 +1,87 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator\Step;
use Sensio\Bundle\DistributionBundle\Configurator\Form\SecretStepType;
use Symfony\Component\Validator\Constraints as Assert;
/**
* Secret Step.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class SecretStep implements StepInterface
{
/**
* @Assert\NotBlank
*/
public $secret;
public function __construct(array $parameters)
{
if (array_key_exists('secret', $parameters)){
$this->secret = $parameters['secret'];
if ('ThisTokenIsNotSoSecretChangeIt' == $this->secret) {
$this->secret = $this->generateRandomSecret();
}
} else {
$this->secret = $this->generateRandomSecret();
}
}
private function generateRandomSecret()
{
return hash('sha1', uniqid(mt_rand()));
}
/**
* @see StepInterface
*/
public function getFormType()
{
return new SecretStepType();
}
/**
* @see StepInterface
*/
public function checkRequirements()
{
return array();
}
/**
* checkOptionalSettings
*/
public function checkOptionalSettings()
{
return array();
}
/**
* @see StepInterface
*/
public function update(StepInterface $data)
{
return array('secret' => $data->secret);
}
/**
* @see StepInterface
*/
public function getTemplate()
{
return 'SensioDistributionBundle:Configurator/Step:secret.html.twig';
}
}

View File

@@ -0,0 +1,65 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Configurator\Step;
use Symfony\Component\Form\Type\FormTypeInterface;
/**
* StepInterface.
*
* @author Marc Weistroff <marc.weistroff@sensio.com>
*/
interface StepInterface
{
/**
* __construct
*
* @param array $parameters
*/
function __construct(array $parameters);
/**
* Returns the form used for configuration.
*
* @return FormTypeInterface
*/
function getFormType();
/**
* Checks for requirements.
*
* @return array
*/
function checkRequirements();
/**
* Checks for optional setting it could be nice to have.
*
* @return array
*/
function checkOptionalSettings();
/**
* Returns the template to be renderer for this step.
*
* @return string
*/
function getTemplate();
/**
* Updates form data parameters.
*
* @param array $parameters
* @return array
*/
function update(StepInterface $data);
}

View File

@@ -0,0 +1,107 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle\Controller;
use Symfony\Component\DependencyInjection\ContainerAware;
use Symfony\Component\HttpFoundation\RedirectResponse;
/**
* ConfiguratorController.
*
* @author Fabien Potencier <fabien@symfony.com>
*/
class ConfiguratorController extends ContainerAware
{
/**
* @return Response A Response instance
*/
public function stepAction($index = 0)
{
$configurator = $this->container->get('sensio.distribution.webconfigurator');
$step = $configurator->getStep($index);
$form = $this->container->get('form.factory')->create($step->getFormType(), $step);
$request = $this->container->get('request');
if ('POST' === $request->getMethod()) {
$form->bindRequest($request);
if ($form->isValid()) {
$configurator->mergeParameters($step->update($form->getData()));
$configurator->write();
$index++;
if ($index < $configurator->getStepCount()) {
return new RedirectResponse($this->container->get('router')->generate('_configurator_step', array('index' => $index)));
}
return new RedirectResponse($this->container->get('router')->generate('_configurator_final'));
}
}
return $this->container->get('templating')->renderResponse($step->getTemplate(), array(
'form' => $form->createView(),
'index' => $index,
'count' => $configurator->getStepCount(),
'version' => $this->getVersion(),
));
}
public function checkAction()
{
$configurator = $this->container->get('sensio.distribution.webconfigurator');
// Trying to get as much requirements as possible
$majors = $configurator->getRequirements();
$minors = $configurator->getOptionalSettings();
$url = $this->container->get('router')->generate('_configurator_step', array('index' => 0));
if (empty($majors) && empty($minors)) {
return new RedirectResponse($url);
}
return $this->container->get('templating')->renderResponse('SensioDistributionBundle::Configurator/check.html.twig', array(
'majors' => $majors,
'minors' => $minors,
'url' => $url,
'version' => $this->getVersion(),
));
}
public function finalAction()
{
$configurator = $this->container->get('sensio.distribution.webconfigurator');
$configurator->clean();
try {
$welcomeUrl = $this->container->get('router')->generate('_welcome');
} catch (\Exception $e) {
$welcomeUrl = null;
}
return $this->container->get('templating')->renderResponse('SensioDistributionBundle::Configurator/final.html.twig', array(
'welcome_url' => $welcomeUrl,
'parameters' => $configurator->render(),
'yml_path' => $this->container->getParameter('kernel.root_dir').'/config/parameters.yml',
'is_writable' => $configurator->isFileWritable(),
'version' => $this->getVersion(),
));
}
public function getVersion()
{
$kernel = $this->container->get('kernel');
return $kernel::VERSION;
}
}

View File

@@ -0,0 +1,33 @@
<?php
namespace Sensio\Bundle\DistributionBundle\DependencyInjection;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
use Symfony\Component\Config\FileLocator;
/**
* SensioDistributionExtension.
*
* @author Marc Weistroff <marc.weistroff@sensio.com>
*/
class SensioDistributionExtension extends Extension
{
public function load(array $configs, ContainerBuilder $container)
{
$loader = new XmlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config'));
$loader->load('webconfigurator.xml');
}
public function getNamespace()
{
return 'http://symfony.com/schema/dic/symfony/sensiodistribution';
}
public function getAlias()
{
return 'sensio_distribution';
}
}

View File

@@ -0,0 +1,19 @@
Copyright (c) 2010,2011 Fabien Potencier
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@@ -0,0 +1,102 @@
#!/bin/sh
# This file is part of the Symfony Standard Edition.
#
# (c) Fabien Potencier <fabien@symfony.com>
#
# For the full copyright and license information, please view the LICENSE
# file that was distributed with this source code.
DIR=`php -r "echo realpath(dirname(\\$_SERVER['argv'][0]));"`
cd $DIR
VERSION=`grep ' VERSION ' vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php | sed -E "s/.*'(.+)'.*/\1/g"`
if [ ! -d "$DIR/build" ]; then
mkdir -p $DIR/build
fi
# Without vendors
rm -rf /tmp/Symfony
mkdir /tmp/Symfony
cp -r app /tmp/Symfony/
cp -r src /tmp/Symfony/
cp -r web /tmp/Symfony/
cp README.md /tmp/Symfony/
cp LICENSE /tmp/Symfony/
cp composer.json /tmp/Symfony/
cp composer.lock /tmp/Symfony/
cd /tmp/Symfony
sudo rm -rf app/cache/* app/logs/* .git*
chmod 777 app/cache app/logs
# DS_Store cleanup
find . -name .DS_Store | xargs rm -rf -
cd ..
# avoid the creation of ._* files
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
tar zcpf $DIR/build/Symfony_Standard_$VERSION.tgz Symfony
sudo rm -f $DIR/build/Symfony_Standard_$VERSION.zip
zip -rq $DIR/build/Symfony_Standard_$VERSION.zip Symfony
# With vendors
cd $DIR
rm -rf /tmp/vendor
mkdir /tmp/vendor
TARGET=/tmp/vendor
if [ ! -d "$DIR/vendor" ]; then
echo "The master vendor directory does not exist"
exit
fi
cp -r $DIR/vendor/* $TARGET/
# Doctrine ORM
cd $TARGET/doctrine/orm && rm -rf UPGRADE* build* bin tests tools lib/vendor
# Doctrine DBAL
cd $TARGET/doctrine/dbal && rm -rf bin build* tests lib/vendor
# Doctrine Common
cd $TARGET/doctrine/common && rm -rf build* tests lib/vendor
# Swiftmailer
cd $TARGET/swiftmailer/swiftmailer && rm -rf CHANGES README* build* docs notes test-suite tests create_pear_package.php package*
# Symfony
cd $TARGET/symfony/symfony && rm -rf README.md phpunit.xml* tests *.sh vendor
# Twig
cd $TARGET/twig/twig && rm -rf AUTHORS CHANGELOG README.markdown bin doc package.xml.tpl phpunit.xml* test
# Twig Extensions
cd $TARGET/twig/extensions && rm -rf README doc phpunit.xml* test
# Monolog
cd $TARGET/monolog/monolog && rm -rf README.markdown phpunit.xml* tests
# Sensio
cd $TARGET/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/ && rm -rf phpunit.xml* Tests CHANGELOG*
cd $TARGET/sensio/framework-extra-bundle/Sensio/Bundle/FrameworkExtraBundle/ && rm -rf phpunit.xml* Tests CHANGELOG*
cd $TARGET/sensio/generator-bundle/Sensio/Bundle/GeneratorBundle/ && rm -rf phpunit.xml* Tests CHANGELOG*
# JMS
cd $TARGET/jms/metadata && rm -rf README.rst phpunit.xml* tests
cd $TARGET/jms/cg && rm -rf README.rst phpunit.xml* tests
cd $TARGET/jms/aop-bundle/JMS/AopBundle && rm -rf phpunit.xml* Tests
cd $TARGET/jms/di-extra-bundle/JMS/DiExtraBundle && rm -rf phpunit.xml* Tests
cd $TARGET/jms/security-extra-bundle/JMS/SecurityExtraBundle/ && rm -rf phpunit.xml* Tests
# cleanup
find $TARGET -name .git | xargs rm -rf -
find $TARGET -name .gitignore | xargs rm -rf -
find $TARGET -name .gitmodules | xargs rm -rf -
find $TARGET -name .svn | xargs rm -rf -
cd /tmp/
mv /tmp/vendor /tmp/Symfony/
tar zcpf $DIR/build/Symfony_Standard_Vendors_$VERSION.tgz Symfony
sudo rm -f $DIR/build/Symfony_Standard_Vendors_$VERSION.zip
zip -rq $DIR/build/Symfony_Standard_Vendors_$VERSION.zip Symfony

View File

@@ -0,0 +1,26 @@
#!/usr/bin/env php
<?php
/*
* This file is part of the Symfony Standard Edition.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
$argv = $_SERVER['argv'];
// allow the base path to be passed as the first argument, or default
if (isset($argv[1])) {
$appDir = $argv[1];
} else {
if (!$appDir = realpath(__DIR__.'/../../../../../../../app')) {
exit('Looks like you don\'t have a standard layout.');
}
}
require_once $appDir.'/autoload.php';
\Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::doBuildBootstrap($appDir);

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8" ?>
<routes xmlns="http://symfony.com/schema/routing"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/routing http://symfony.com/schema/routing/routing-1.0.xsd">
<route id="_configurator_home" pattern="/">
<default key="_controller">SensioDistributionBundle:Configurator:check</default>
</route>
<route id="_configurator_step" pattern="/step/{index}">
<default key="_controller">SensioDistributionBundle:Configurator:step</default>
</route>
<route id="_configurator_final" pattern="/final">
<default key="_controller">SensioDistributionBundle:Configurator:final</default>
</route>
</routes>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" ?>
<container xmlns="http://symfony.com/schema/dic/services"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd">
<parameters>
<parameter key="sensio.distribution.webconfigurator.class">Sensio\Bundle\DistributionBundle\Configurator\Configurator</parameter>
</parameters>
<services>
<service id="sensio.distribution.webconfigurator" class="%sensio.distribution.webconfigurator.class%">
<argument>%kernel.root_dir%</argument>
</service>
</services>
</container>

View File

@@ -0,0 +1,153 @@
@import url("install.css");
h1 {
margin-top: 10px;
font-size: 26px;
}
#symfony-wrapper {
padding-top: 0;
}
#symfony-search {
position: absolute;
top: 50px;
right: 30px;
}
#symfony-search-field {
width: 190px;
}
#symfony-search label {
display: block;
float: left;
width: 20px;
height: 25px;
background: url(../images/search.png) no-repeat left 5px;
}
#symfony-search label span {
display: none;
}
input[type=text] {
border: 1px solid #DADADA;
background: white url(../images/field-background.gif) repeat-x left top;
padding: 5px 6px;
color: #565656;
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
font-size: 12px;
}
.symfony-button-grey, .symfony-button-green {
font-size: 0.85em;
font-weight: bold;
cursor: pointer;
display: inline-block;
outline: none;
text-align: center;
text-transform: uppercase;
padding: 3px 10px;
text-shadow: 0 1px 1px rgba(0,0,0,.3);
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.symfony-button-grey {
color: #868686;
font-weight: normal;
padding: 5px 10px;
border: solid 1px #d7d7d7;
background: #ffffff;
background: -webkit-gradient(linear, left top, left bottom, from(#ffffff), to(#d7d7d7));
background: -moz-linear-gradient(top, #ffffff, #d7d7d7);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ffffff', endColorstr='#d7d7d7');
}
.symfony-button-green {
padding: 5px 12px;
color: white;
border: solid 1px #a7da39;
background: #a7da39;
background: -webkit-gradient(linear, left top, left bottom, from(#a7da39), to(#6a9211));
background: -moz-linear-gradient(top, #a7da39, #6a9211);
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#a7da39', endColorstr='#6a9211');
}
.symfony-block-steps span {
display: inline-block;
padding: 2px 3px;
font-size: 11px;
line-height: 15px;
color: #868686;
font-weight: bold;
text-transform: uppercase;
}
.symfony-block-steps span.selected {
background-color: #aacd4e;
color: #FFFFFF;
}
.symfony-form-row {
padding-bottom: 40px;
}
.symfony-form-column {
width: 430px;
float: left;
}
.symfony-form-footer {
padding-top: 20px;
clear: both;
}
.symfony-form-field {
height: 20px;
}
.symfony-form-row label {
display: block;
padding-bottom: 8px;
}
.symfony-form-field input[type=text],
.symfony-form-field input[type=password],
.symfony-form-field textarea,
.symfony-form-field select {
font-size: 13px;
color: #565656;
width: 200px;
}
.symfony-form-field input[type=text],
.symfony-form-field input[type=password],
.symfony-form-field textarea {
border: 1px solid #dadada;
background: #FFFFFF url(../images/background-textfield.gif) repeat-x left top;
width: 194px;
padding: 5px 6px;
}
.symfony-form-errors ul {
padding: 0;
}
.symfony-form-errors li {
background: url(../images/notification.gif) no-repeat left 6px;
font-size: 11px;
line-height: 16px;
color: #759e1a;
padding: 10px 25px;
}
.symfony-configuration {
margin: 10px 0;
width: 100%;
height: 240px;
}

View File

@@ -0,0 +1,137 @@
/*
Copyright (c) 2010, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.8.2r1
Reset
*/
html{color:#000;background:#FFF;}body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td{margin:0;padding:0;}table{border-collapse:collapse;border-spacing:0;}fieldset,img{border:0;}address,caption,cite,code,dfn,em,strong,th,var,optgroup{font-style:inherit;font-weight:inherit;}del,ins{text-decoration:none;}li{list-style:none;}caption,th{text-align:left;}h1,h2,h3,h4,h5,h6{font-size:100%;font-weight:normal;}q:before,q:after{content:'';}abbr,acronym{border:0;font-variant:normal;}sup{vertical-align:baseline;}sub{vertical-align:baseline;}legend{color:#000;}input,button,textarea,select,optgroup,option{font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;}input,button,textarea,select{*font-size:100%;}
html, body {
background-color: #EFEFEF;
}
body {
font-size: 14px;
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
color: #313131;
}
a {
color: #08C;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
strong {
font-weight: bold;
}
em {
font-style: italic;
}
h1, h2, h3 {
font-family: Georgia, "Times New Roman", Times, serif;
color: #404040;
}
h1 {
font-size: 45px;
padding-bottom: 30px;
}
h2 {
font-weight: bold;
color: #FFFFFF;
/* Font is reset to sans-serif (like body) */
font-family: "Lucida Sans Unicode", "Lucida Grande", Verdana, Arial, Helvetica, sans-serif;
margin-bottom: 10px;
background-color: #aacd4e;
padding: 2px 4px;
display: inline-block;
text-transform: uppercase;
}
p {
line-height: 20px;
padding-bottom: 20px;
}
ul a {
background: url(../images/blue-arrow.png) no-repeat right 6px;
padding-right: 10px;
}
ul, ol {
padding-left: 20px;
}
li {
padding-bottom: 18px;
}
ol li {
list-style-type: decimal;
}
ul li {
list-style-type: none;
}
#symfony-header {
position: relative;
padding: 30px 30px 20px 30px;
}
#symfony-wrapper {
width: 970px;
margin: 0 auto;
padding-top: 50px;
}
#symfony-content {
background-color: white;
border: 1px solid #DFDFDF;
padding: 50px;
-moz-border-radius: 16px;
-webkit-border-radius: 16px;
border-radius: 16px;
margin-bottom: 5px;
}
.symfony-blocks-install {
overflow: hidden;
}
.symfony-blocks-install .symfony-block-logo {
float: left;
width: 358px;
}
.symfony-blocks-install .symfony-block-content {
float: left;
width: 510px;
}
.symfony-install-continue {
font-size: 0.95em;
padding-left: 0;
}
.symfony-install-continue li {
padding-bottom: 10px;
}
.version {
text-align: right;
font-size: 10px;
margin-right: 20px;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 206 B

View File

@@ -0,0 +1,31 @@
{% extends "SensioDistributionBundle::Configurator/layout.html.twig" %}
{% block title %}Symfony - Configure database{% endblock %}
{% block content %}
{% form_theme form "SensioDistributionBundle::Configurator/form.html.twig" %}
{% include "SensioDistributionBundle::Configurator/steps.html.twig" with { "index": index, "count": count } %}
<h1>Configure your Database</h1>
<p>If your website needs a database connection, please configure it here.</p>
{{ form_errors(form) }}
<form action="{{ path('_configurator_step', { 'index': index }) }}" method="POST">
<div class="symfony-form-column">
{{ form_row(form.driver) }}
{{ form_row(form.host) }}
{{ form_row(form.name) }}
</div>
<div class="symfony-form-column">
{{ form_row(form.user) }}
{{ form_row(form.password) }}
</div>
{{ form_rest(form) }}
<div class="symfony-form-footer">
<p><input type="submit" value="Next Step" class="symfony-button-grey" /></p>
<p>* mandatory fields</p>
</div>
</form>
{% endblock %}

View File

@@ -0,0 +1,44 @@
{% extends "SensioDistributionBundle::Configurator/layout.html.twig" %}
{% block title %}Symfony - Configure global Secret{% endblock %}
{% block content %}
{% form_theme form "SensioDistributionBundle::Configurator/form.html.twig" %}
{% include "SensioDistributionBundle::Configurator/steps.html.twig" with { "index": index, "count": count } %}
<h1>Global Secret</h1>
<p>Configure the global secret for your website (the secret is used for the CSRF protection among other things):</p>
{{ form_errors(form) }}
<form action="{{ path('_configurator_step', { 'index': index }) }} " method="POST">
<div class="symfony-form-row">
{{ form_label(form.secret) }}
<div class="symfony-form-field">
{{ form_widget(form.secret) }}
<a class="symfony-button-grey" href="#" onclick="generateSecret(); return false;">Generate</a>
<div class="symfony-form-errors">
{{ form_errors(form.secret) }}
</div>
</div>
</div>
{{ form_rest(form) }}
<div class="symfony-form-footer">
<p><input type="submit" value="Next Step" class="symfony-button-grey" /></p>
<p>* mandatory fields</p>
</div>
</form>
<script type="text/javascript">
function generateSecret()
{
var result = '';
for (i=0; i < 32; i++) {
result += Math.round(Math.random()*16).toString(16);
}
document.getElementById('distributionbundle_secret_step_secret').value = result;
}
</script>
{% endblock %}

View File

@@ -0,0 +1,43 @@
{% extends "SensioDistributionBundle::Configurator/layout.html.twig" %}
{% block content %}
{% if majors|length %}
<h1>Major Problems that need to be fixed now</h1>
<p>
We have detected <strong>{{ majors|length }}</strong> major problems.
You <em>must</em> fix them before continuing:
</p>
<ol>
{% for message in majors %}
<li>{{ message }}</li>
{% endfor %}
</ol>
{% endif %}
{% if minors|length %}
<h1>Some Recommandations</h1>
<p>
{% if majors|length %}
Additionally, we
{% else %}
We
{% endif %}
have detected some minor problems that we <em>recommend</em> you to fix to have a better Symfony
experience:
<ol>
{% for message in minors %}
<li>{{ message }}</li>
{% endfor %}
</ol>
</p>
{% endif %}
{% if not majors|length %}
<ul class="symfony_list">
<li><a href="{{ url }}">Configure your Symfony Application online</a></li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,28 @@
{% extends "SensioDistributionBundle::Configurator/layout.html.twig" %}
{% block content_class %}config_done{% endblock %}
{% block content %}
<h1>Well done!</h1>
{% if is_writable %}
<h2>Your distribution is configured!</h2>
{% else %}
<h2 class="configure-error">Your distribution is almost configured but...</h2>
{% endif %}
<h3>
<span>
{% if is_writable %}
Your parameters.yml file has been overwritten with these parameters (in <em>{{ yml_path }}</em>):
{% else %}
Your parameters.yml file is not writeable! Here are the parameters you can copy and paste in <em>{{ yml_path }}</em>:
{% endif %}
</span>
</h3>
<textarea class="symfony-configuration">{{ parameters }}</textarea>
{% if welcome_url %}
<ul>
<li><a href="{{ welcome_url }}">Go to the Welcome page</a></li>
</ul>
{% endif %}
{% endblock %}

View File

@@ -0,0 +1,31 @@
{% extends "form_div_layout.html.twig" %}
{% block field_rows %}
<div class="symfony-form-errors">
{{ form_errors(form) }}
</div>
{% for child in form.children %}
{{ form_row(child) }}
{% endfor %}
{% endblock field_rows %}
{% block field_row %}
<div class="symfony-form-row">
{{ form_label(form) }}
<div class="symfony-form-field">
{{ form_widget(form) }}
<div class="symfony-form-errors">
{{ form_errors(form) }}
</div>
</div>
</div>
{% endblock %}
{% block field_label %}
<label for="{{ id }}">
{{ label|trans }}
{% if required %}
<span class="symfony-form-required" title="This field is required">*</span>
{% endif %}
</label>
{% endblock %}

View File

@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<link rel="stylesheet" href="{{ asset('bundles/sensiodistribution/webconfigurator/css/configure.css') }}" />
<title>{% block title %}Web Configurator Bundle{% endblock %}</title>
<link rel="icon" type="image/x-icon" sizes="16x16" href="{{ asset('bundles/sensiodistribution/webconfigurator/images/favicon.ico') }}" />
</head>
<body>
<div id="symfony-wrapper">
<div id="symfony-header">
<img src="{{ asset("bundles/sensiodistribution/webconfigurator/images/logo-small.gif") }}" alt="Symfony logo" />
</div>
<div id="symfony-content">
{% block content %}{% endblock %}
</div>
<div class="version">Symfony Standard Edition v.{{ version }}</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,14 @@
<div class="symfony-block-steps">
{% for i in 1..count %}
{% if i == index + 1 %}
<span class="selected">Step {{ i }}</span>
{% else %}
<span>Step {{ i }}</span>
{% endif %}
{% if i != count %}
&gt;
{% endif %}
{% endfor %}
</div>

View File

@@ -0,0 +1,32 @@
<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Sensio\Bundle\DistributionBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Sensio\Bundle\DistributionBundle\Configurator\Step\DoctrineStep;
use Sensio\Bundle\DistributionBundle\Configurator\Step\SecretStep;
/**
* SensioDistributionBundle.
*
* @author Fabien Potencier <fabien@symfony.com>
* @author Marc Weistroff <marc.weistroff@sensio.com>
*/
class SensioDistributionBundle extends Bundle
{
public function boot()
{
$configurator = $this->container->get('sensio.distribution.webconfigurator');
$configurator->addStep(new DoctrineStep($configurator->getParameters()));
$configurator->addStep(new SecretStep($configurator->getParameters()));
}
}

View File

@@ -0,0 +1,20 @@
{
"name": "sensio/distribution-bundle",
"description": "The base bundle for the Symfony Distributions",
"keywords": ["distribution","configuration"],
"type": "symfony-bundle",
"license": "MIT",
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com"
}
],
"require": {
"symfony/framework-bundle": "2.1.*"
},
"autoload": {
"psr-0": { "Sensio\\Bundle\\DistributionBundle": "" }
},
"target-dir": "Sensio/Bundle/DistributionBundle"
}