Permalink
Browse files

Merge pull request #11 from KnpLabs/app-and-resources

Returning `app` and `Resources` folders
  • Loading branch information...
2 parents e45cd73 + a0c3535 commit 201cea93415ec0962a13370efa732ba698a69ca1 @everzet everzet committed Mar 2, 2012
Showing with 73 additions and 379 deletions.
  1. +3 −44 Command/AssetsInstallCommand.php
  2. +2 −2 Command/GenerateControllerCommand.php
  3. +1 −1 Command/GenerateTwigExtensionCommand.php
  4. +0 −48 DependencyInjection/Compiler/ApplicationStructurePass.php
  5. +9 −21 ...dencyInjection/Compiler/{AsseticTemplateResourcesPass.php → ApplicationTemplateResourcesPass.php}
  6. +0 −62 DependencyInjection/Compiler/TranslationsLocatorPass.php
  7. +0 −3 DependencyInjection/Configuration.php
  8. +3 −18 DependencyInjection/Extension/AppExtension.php
  9. +5 −5 DependencyInjection/Extension/ConfigurationDumper.php
  10. +0 −2 DependencyInjection/KnpRadExtension.php
  11. +1 −1 HttpKernel/KernelConfiguration.php
  12. +29 −18 HttpKernel/RadKernel.php
  13. +2 −7 KnpRadBundle.php
  14. 0 Resources/skeleton/application/{ → Resources}/config/routing.yml
  15. 0 Resources/skeleton/application/{ → Resources}/config/services.yml
  16. 0 Resources/skeleton/application/{ → Resources}/public/css/style.css
  17. 0 Resources/skeleton/application/{ → Resources}/public/js/script.js
  18. 0 Resources/skeleton/application/{ → Resources}/views/layout.html.twig
  19. +0 −12 Resources/skeleton/application/Tests/SomethingTest.php
  20. 0 Resources/skeleton/config/app/{bundles → }/config.yml
  21. 0 Resources/skeleton/config/assetic/{bundles → }/config.yml
  22. 0 Resources/skeleton/config/doctrine/{bundles → }/config.yml
  23. 0 Resources/skeleton/config/doctrine_mongodb/{bundles → }/config.yml
  24. +1 −1 Resources/skeleton/config/fos_user/{bundles → }/config.yml
  25. 0 Resources/skeleton/config/fos_user/routing/{dev.yml → all.yml}
  26. 0 Resources/skeleton/config/framework/{bundles → }/config.yml
  27. +0 −15 Resources/skeleton/config/imagine/bundles/config.yml
  28. 0 Resources/skeleton/config/knp_paginator/{bundles → }/config.yml
  29. +2 −3 Resources/skeleton/config/knp_rad/{bundles → }/config.yml
  30. +7 −0 Resources/skeleton/config/monolog/{bundles → }/config.yml
  31. 0 Resources/skeleton/config/security/{bundles → }/config.yml
  32. 0 Resources/skeleton/config/stof_doctrine_extensions/{bundles → }/config.yml
  33. 0 Resources/skeleton/config/swiftmailer/{bundles → }/config.yml
  34. 0 Resources/skeleton/config/twig/{bundles → }/config.yml
  35. 0 Resources/skeleton/config/web_profiler/{bundles → }/config.yml
  36. 0 Resources/skeleton/project/{config → app}/kernel.yml
  37. +1 −1 Routing/Loader/AppBundleLoader.php
  38. +0 −51 Templating/TemplateNameParser.php
  39. +0 −32 Templating/TemplateReference.php
  40. +4 −23 Tests/DependencyInjection/Extension/AppExtensionTest.php
  41. 0 Tests/DependencyInjection/Extension/fixtures/{single → Resources}/config/services.yml
  42. 0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/one.xml
  43. 0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/services.yml
  44. 0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/services_two.yml
  45. 0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/two.xml
  46. 0 Tests/DependencyInjection/Extension/fixtures/single/config/services.xml
  47. +1 −1 Tests/Routing/Loader/AppBundleLoaderTest.php
  48. 0 Tests/Routing/Loader/Fixtures/{single → Resources}/config/routing.yml
  49. +0 −3 Tests/Routing/Loader/Fixtures/multiple/config/routing/routes1.yml
  50. +0 −3 Tests/Routing/Loader/Fixtures/multiple/config/routing/routes2.yml
  51. +2 −2 bin/generate-rad-project
View
47 Command/AssetsInstallCommand.php
@@ -32,6 +32,9 @@ class AssetsInstallCommand extends BaseCommand
protected function configure()
{
$this
+ ->setDefinition(array(
+ new InputArgument('target', InputArgument::OPTIONAL, 'The target directory (usually "web")', 'web'),
+ ))
->addOption('symlink', null, InputOption::VALUE_NONE, 'Symlinks the assets instead of copying it')
->addOption('relative', null, InputOption::VALUE_NONE, 'Make relative symlinks')
->setDescription('Installs bundles web assets under a public web directory')
@@ -58,48 +61,4 @@ protected function configure()
->setName('assets:install')
;
}
-
- /**
- * {@inheritdoc}
- */
- protected function execute(InputInterface $input, OutputInterface $output)
- {
- $targetArg = rtrim($this->getContainer()->getParameter('kernel.web_dir'), '/');
-
- if (!is_dir($targetArg)) {
- throw new \InvalidArgumentException(sprintf('The target directory "%s" does not exist.', $input->getArgument('target')));
- }
-
- if (!function_exists('symlink') && $input->getOption('symlink')) {
- throw new \InvalidArgumentException('The symlink() function is not available on your system. You need to install the assets without the --symlink option.');
- }
-
- $filesystem = $this->getContainer()->get('filesystem');
-
- // Create the bundles directory otherwise symlink will fail.
- $filesystem->mkdir($targetArg.'/bundles/', 0777);
-
- foreach ($this->getContainer()->get('kernel')->getBundles() as $bundle) {
- $originDir = $bundle->getPath().'/Resources/public';
- if ($bundle instanceof AppBundle) {
- $originDir = $bundle->getPath().'/public';
- }
-
- if (is_dir($originDir)) {
- $targetDir = $targetArg.'/bundles/'.preg_replace('/bundle$/', '', strtolower($bundle->getName()));
-
- $output->writeln(sprintf('Installing assets for <comment>%s</comment> into <comment>%s</comment>', $bundle->getNamespace(), $targetDir));
-
- $filesystem->remove($targetDir);
-
- if ($input->getOption('symlink')) {
- $filesystem->symlink($originDir, $targetDir);
- } else {
- $filesystem->mkdir($targetDir, 0777);
- // We use a custom iterator to ignore VCS files
- $filesystem->mirror($originDir, $targetDir, Finder::create()->in($originDir));
- }
- }
- }
- }
}
View
4 Command/GenerateControllerCommand.php
@@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeLn(' method <info>already exists</info>');
}
- $viewPath = sprintf('%s/views/%s/%s.html.twig',
+ $viewPath = sprintf('%s/Resources/views/%s/%s.html.twig',
$bundle->getPath(), str_replace('\\', '/', $controller), $action
);
@@ -113,7 +113,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeLn(' view <info>already exists</info>');
}
- $routingPath = sprintf('%s/config/routing.yml', $bundle->getPath());
+ $routingPath = sprintf('%s/Resources/config/routing.yml', $bundle->getPath());
$routeName = $this->underscore($name).'_'.$this->underscore($action);
$routePath = '/'.$this->underscore($name).'/'.$this->underscore($action);
$controller = 'App:'.str_replace('/', '\\', $controller).':'.$action;
View
2 Command/GenerateTwigExtensionCommand.php
@@ -57,7 +57,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
}
// generate the service definition
- $servicesPath = sprintf('%s/config/services.yml', $bundle->getPath());
+ $servicesPath = sprintf('%s/Resources/config/services.yml', $bundle->getPath());
$output->writeLn(sprintf("\n".'- <comment>app.twig.%s_extension</comment> service:',
strtolower($name)
View
48 DependencyInjection/Compiler/ApplicationStructurePass.php
@@ -1,48 +0,0 @@
-<?php
-
-/*
- * This file is part of the KnpRadBundle package.
- *
- * (c) KnpLabs <http://knplabs.com/>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Knp\Bundle\RadBundle\DependencyInjection\Compiler;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
-
-/**
- * Patches internal Symfony2 services to be RAD.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- */
-class ApplicationStructurePass implements CompilerPassInterface
-{
- /**
- * Patches kernel parameters.
- *
- * @param ContainerBuilder $container Container instance
- */
- public function process(ContainerBuilder $container)
- {
- if (!$container->getParameter('knp_rad.application_structure')) {
- return;
- }
-
- $container->setParameter('templating.name_parser.class',
- 'Knp\Bundle\RadBundle\Templating\TemplateNameParser'
- );
-
- $service = $container->findDefinition('file_locator');
- $service->replaceArgument(1, '%kernel.project_dir%');
-
- $service = $container->findDefinition('templating.finder');
- $service->replaceArgument(2, '%kernel.project_dir%');
-
- $service = $container->findDefinition('templating.helper.code');
- $service->replaceArgument(2, '%kernel.project_dir%');
- }
-}
View
30 ...Compiler/AsseticTemplateResourcesPass.php → ...iler/ApplicationTemplateResourcesPass.php
@@ -20,39 +20,27 @@
*
* @author Konstantin Kudryashov <ever.zet@gmail.com>
*/
-class AsseticTemplateResourcesPass extends BasePass
+class ApplicationTemplateResourcesPass extends BasePass
{
/**
- * Patches kernel parameters.
- *
- * @param ContainerBuilder $container Container instance
- */
- public function process(ContainerBuilder $container)
- {
- if (!$container->getParameter('knp_rad.application_structure')) {
- return;
- }
-
- parent::process($container);
- }
-
- /**
* {@inheritdoc}
*/
protected function setBundleDirectoryResources(ContainerBuilder $container, $engine, $bundleDirName, $bundleName)
{
+ if ('App' === $bundleName) {
+ parent::setBundleDirectoryResources(
+ $container,
+ $engine,
+ $container->getParameter('kernel.project_dir'),
+ $bundleName
+ );
+ }
}
/**
* {@inheritdoc}
*/
protected function setAppDirectoryResources(ContainerBuilder $container, $engine)
{
- $container->setDefinition(
- 'assetic.'.$engine.'_directory_resource.kernel',
- new DirectoryResourceDefinition('', $engine, array(
- $container->getParameter('kernel.project_dir').'/views'
- ))
- );
}
}
View
62 DependencyInjection/Compiler/TranslationsLocatorPass.php
@@ -1,62 +0,0 @@
-<?php
-
-/*
- * This file is part of the KnpRadBundle package.
- *
- * (c) KnpLabs <http://knplabs.com/>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Knp\Bundle\RadBundle\DependencyInjection\Compiler;
-
-use Symfony\Component\DependencyInjection\ContainerBuilder;
-use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
-use Symfony\Component\Finder\Finder;
-
-/**
- * Adds application bundle i18n folder support.
- *
- * @author Konstantin Kudryashov <ever.zet@gmail.com>
- */
-class TranslationsLocatorPass implements CompilerPassInterface
-{
- /**
- * Processes application bundle i18n files.
- *
- * @param ContainerBuilder $container Container instance
- */
- public function process(ContainerBuilder $container)
- {
- if (!$container->hasDefinition('translator.default')) {
- return;
- }
- if (!$container->getParameter('knp_rad.application_structure')) {
- return;
- }
-
- $translator = $container->findDefinition('translator');
- $projectDir = $container->getParameter('kernel.project_dir');
-
- $dirs = array();
- if (is_dir($dir = $projectDir.'/translations')) {
- $dirs[] = $dir;
- }
-
- // Register translation resources
- if ($dirs) {
- $finder = new Finder();
- $finder->files()->filter(function (\SplFileInfo $file) {
- return 2 === substr_count($file->getBasename(), '.') && preg_match('/\.\w+$/', $file->getBasename());
- })->in($dirs);
-
- foreach ($finder as $file) {
- // filename is domain.locale.format
- list($domain, $locale, $format) = explode('.', $file->getBasename(), 3);
-
- $translator->addMethodCall('addResource', array($format, (string) $file, $locale, $domain));
- }
- }
- }
-}
View
3 DependencyInjection/Configuration.php
@@ -52,9 +52,6 @@ public function getConfigTreeBuilder()
->booleanNode('application_views')
->defaultFalse()
->end()
- ->booleanNode('application_structure')
- ->defaultFalse()
- ->end()
->end()
;
View
21 DependencyInjection/Extension/AppExtension.php
@@ -12,7 +12,6 @@
namespace Knp\Bundle\RadBundle\DependencyInjection\Extension;
use Symfony\Component\HttpKernel\DependencyInjection\Extension;
-use Symfony\Component\DependencyInjection\Loader\XmlFileLoader;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Config\Definition\Processor;
@@ -45,14 +44,10 @@ public function __construct($path)
*/
public function load(array $configs, ContainerBuilder $container)
{
- $xmlLoader = $this->getXmlFileLoader($container);
$ymlLoader = $this->getYamlFileLoader($container);
- if (file_exists($services = $this->path.'/config/services.xml')) {
- $xmlLoader->load($services);
- }
- if (file_exists($services = $this->path.'/config/services.yml')) {
- $ymlLoader->load($services);
+ if (file_exists($this->path.'/Resources/config/services.yml')) {
+ $ymlLoader->load('services.yml');
}
foreach ($configs as $config) {
@@ -73,22 +68,12 @@ public function getAlias()
}
/**
- * Returns new container XmlFileLoader.
- *
- * @return XmlFileLoader
- */
- protected function getXmlFileLoader(ContainerBuilder $container)
- {
- return new XmlFileLoader($container, new FileLocator($this->path.'/config'));
- }
-
- /**
* Returns new container YamlFileLoader.
*
* @return YamlFileLoader
*/
protected function getYamlFileLoader(ContainerBuilder $container)
{
- return new YamlFileLoader($container, new FileLocator($this->path.'/config'));
+ return new YamlFileLoader($container, new FileLocator($this->path.'/Resources/config'));
}
}
View
10 DependencyInjection/Extension/ConfigurationDumper.php
@@ -31,14 +31,14 @@ public function getAlias()
public function isAlreadyDumped()
{
- return file_exists($this->configPath.'/bundles/'.$this->getAlias().'.yml');
+ return file_exists($this->configPath.'/config/'.$this->getAlias().'.yml');
}
public function dump()
{
$output = sprintf('<comment>%s:</comment>', $this->getAlias())."\n";
- if (!file_exists($dir = $this->configPath.'/bundles')) {
+ if (!file_exists($dir = $this->configPath.'/config')) {
mkdir($dir, 0777, true);
}
if (!file_exists($dir = $this->configPath.'/routing')) {
@@ -56,9 +56,9 @@ public function dump()
public function dumpProvidedConfig()
{
- $configPath = $this->configPath.'/bundles/'.$this->getAlias().'.yml';
+ $configPath = $this->configPath.'/config/'.$this->getAlias().'.yml';
file_put_contents($configPath, "\n".file_get_contents(
- $this->templatesPath.'/bundles/config.yml'
+ $this->templatesPath.'/config.yml'
), FILE_APPEND);
$output = sprintf(' <info>+config</info> %s',
@@ -87,7 +87,7 @@ public function dumpProvidedConfig()
public function dumpEmptyConfig()
{
- $path = $this->configPath.'/bundles/'.$this->getAlias().'.yml';
+ $path = $this->configPath.'/config/'.$this->getAlias().'.yml';
file_put_contents($path, <<<YAML
all: ~
View
2 DependencyInjection/KnpRadExtension.php
@@ -73,7 +73,5 @@ public function load(array $configs, ContainerBuilder $container)
}
$loader->load('assetic_coffee_fix.xml');
-
- $container->setParameter('knp_rad.application_structure', $config['application_structure']);
}
}
View
2 HttpKernel/KernelConfiguration.php
@@ -104,7 +104,7 @@ public function getProjectName()
{
if (null === $this->projectName) {
throw new \InvalidArgumentException(
- 'Specify your `project` name inside config/project.yml or config/project.local.yml'
+ 'Specify your `project` name inside app/kernel.yml or app/kernel.custom.yml'
);
}
View
47 HttpKernel/RadKernel.php
@@ -104,7 +104,7 @@ static public function createAppKernel(ClassLoader $loader, $environment, $debug
};
$loader->add(null, self::$projectRootDir.'/src');
- if (file_exists($custom = self::$projectRootDir.'/config/autoload.php')) {
+ if (file_exists($custom = self::$projectRootDir.'/app/autoload.php')) {
require($custom);
} else {
$autoloadAnnotations();
@@ -120,42 +120,52 @@ static public function createAppKernel(ClassLoader $loader, $environment, $debug
*
* @return string
*/
- public function getRootDir()
+ public function getProjectRootDir()
{
return self::$projectRootDir;
}
/**
- * Returns project directory.
+ * Returns configuration root directory (app folder).
*
* @return string
*/
- public function getProjectDir()
+ public function getRootDir()
{
- return sprintf('%s/src/%s',
- $this->getRootDir(),
- str_replace('\\', '/', $this->configuration->getProjectName())
- );
+ return $this->getProjectRootDir().'/app';
}
/**
- * Returns web directory.
+ * Returns configuration directory.
*
* @return string
*/
- public function getWebDir()
+ public function getConfigDir()
{
- return $this->getRootDir().'/web';
+ return $this->getRootDir();
}
/**
- * Returns configs directory.
+ * Returns project directory.
*
* @return string
*/
- public function getConfigDir()
+ public function getProjectDir()
+ {
+ return sprintf('%s/src/%s',
+ $this->getProjectRootDir(),
+ str_replace('\\', '/', $this->configuration->getProjectName())
+ );
+ }
+
+ /**
+ * Returns web directory.
+ *
+ * @return string
+ */
+ public function getWebDir()
{
- return $this->getRootDir().'/config';
+ return $this->getProjectRootDir().'/web';
}
/**
@@ -165,7 +175,7 @@ public function getConfigDir()
*/
public function getLogDir()
{
- return $this->getRootDir().'/logs';
+ return $this->getProjectRootDir().'/logs';
}
/**
@@ -175,7 +185,7 @@ public function getLogDir()
*/
public function getCacheDir()
{
- return $this->getRootDir().'/cache/'.$this->environment;
+ return $this->getProjectRootDir().'/cache/'.$this->environment;
}
/**
@@ -198,7 +208,7 @@ public function registerBundles()
// Add KnpRadBundle and AppBundle automatically
$bundles[] = new KnpRadBundle($this);
$bundles[] = new AppBundle(
- $this->configuration->getProjectName(), $this->getRootDir().'/src'
+ $this->configuration->getProjectName(), $this->getProjectRootDir().'/src'
);
return $bundles;
@@ -211,7 +221,7 @@ public function registerContainerConfiguration(LoaderInterface $loader)
{
$configs = Finder::create()
->name('*.yml')
- ->in($this->getConfigDir().'/bundles');
+ ->in($this->getConfigDir().'/config');
foreach ($configs as $file) {
$this->loadConfigFile($file, basename($file, '.yml'), $loader);
@@ -284,6 +294,7 @@ protected function getKernelParameters()
{
return array_merge(
array(
+ 'kernel.project_root' => $this->getProjectRootDir(),
'kernel.project_name' => $this->getConfiguration()->getProjectName(),
'kernel.project_dir' => $this->getProjectDir(),
'kernel.config_dir' => $this->getConfigDir(),
View
9 KnpRadBundle.php
@@ -15,11 +15,8 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Bundle\AsseticBundle\DependencyInjection\Compiler\AssetManagerPass;
-use Knp\Bundle\RadBundle\DependencyInjection\Compiler\TranslationsLocatorPass;
-use Knp\Bundle\RadBundle\DependencyInjection\Compiler\AsseticTemplateResourcesPass;
+use Knp\Bundle\RadBundle\DependencyInjection\Compiler\ApplicationTemplateResourcesPass;
use Knp\Bundle\RadBundle\DependencyInjection\Compiler\AsseticPipelinePass;
-use Knp\Bundle\RadBundle\DependencyInjection\Compiler\RegisterDoctrineMappingDriverPass;
-use Knp\Bundle\RadBundle\DependencyInjection\Compiler\ApplicationStructurePass;
/**
* RadBundle for Symfony2.
@@ -31,10 +28,8 @@ class KnpRadBundle extends Bundle
*/
public function build(ContainerBuilder $container)
{
- $container->addCompilerPass(new AsseticTemplateResourcesPass);
+ $container->addCompilerPass(new ApplicationTemplateResourcesPass);
$container->addCompilerPass(new AsseticPipelinePass);
$container->addCompilerPass(new AssetManagerPass);
- $container->addCompilerPass(new TranslationsLocatorPass);
- $container->addCompilerPass(new ApplicationStructurePass);
}
}
View
0 ...s/skeleton/application/config/routing.yml → .../application/Resources/config/routing.yml
File renamed without changes.
View
0 .../skeleton/application/config/services.yml → ...application/Resources/config/services.yml
File renamed without changes.
View
0 ...skeleton/application/public/css/style.css → ...pplication/Resources/public/css/style.css
File renamed without changes.
View
0 .../skeleton/application/public/js/script.js → ...application/Resources/public/js/script.js
File renamed without changes.
View
0 ...eleton/application/views/layout.html.twig → ...lication/Resources/views/layout.html.twig
File renamed without changes.
View
12 Resources/skeleton/application/Tests/SomethingTest.php
@@ -1,12 +0,0 @@
-<?php
-
-class SomethingTest extends \PHPUnit_Framework_TestCase
-{
- /**
- * @test
- */
- function shouldRenderExpectedLogo()
- {
- $this->assertTrue(true);
- }
-}
View
0 ...es/skeleton/config/app/bundles/config.yml → Resources/skeleton/config/app/config.yml
File renamed without changes.
View
0 ...keleton/config/assetic/bundles/config.yml → Resources/skeleton/config/assetic/config.yml
File renamed without changes.
View
0 ...eleton/config/doctrine/bundles/config.yml → ...urces/skeleton/config/doctrine/config.yml
File renamed without changes.
View
0 ...onfig/doctrine_mongodb/bundles/config.yml → ...eleton/config/doctrine_mongodb/config.yml
File renamed without changes.
View
2 ...eleton/config/fos_user/bundles/config.yml → ...urces/skeleton/config/fos_user/config.yml
@@ -1,7 +1,7 @@
all:
db_driver: orm # other valid values are 'mongodb', 'couchdb', 'propel'
- # you HAVE to provide the firewall's name thas is configured in config/bundles/security.yml
+ # you HAVE to provide the firewall's name thas is configured in app/config/security.yml
firewall_name: secured_area
# You HAVE to implement your own User class
View
0 .../skeleton/config/fos_user/routing/dev.yml → .../skeleton/config/fos_user/routing/all.yml
File renamed without changes.
View
0 ...leton/config/framework/bundles/config.yml → ...rces/skeleton/config/framework/config.yml
File renamed without changes.
View
15 Resources/skeleton/config/imagine/bundles/config.yml
@@ -1,15 +0,0 @@
-# Imagine will provide image manipulation functionality to your Symfony 2 based projects
-# Docs: http://bit.ly/imagine-docs
-# Config: http://bit.ly/imagine-refs
-
-all:
- # Use kernel.yml to configure this parameters
- # This declaration will tell ImagineBundle to prepare image processor 'thumbnail',
- # that will resize images to 50px width, constraining proportions,
- # and then crop the bottom to 50px height, and resave the image in '/uploads/thumbs' directory.
- thumbnail:
- commands:
- - { name: save, arguments: '/web/uploads/%user_id%/images/' }
- - { name: resize, arguments: [50, true] }
- - { name: crop, arguments: [0, 0, 50, 50] }
- - { name: save, arguments: '/web/uploads/%user_id%/thumbnails/' }
View
0 ...n/config/knp_paginator/bundles/config.yml → .../skeleton/config/knp_paginator/config.yml
File renamed without changes.
View
5 ...keleton/config/knp_rad/bundles/config.yml → Resources/skeleton/config/knp_rad/config.yml
@@ -8,16 +8,15 @@ all:
application_routing: true
application_shortaction: true
application_views: true
- application_structure: true
assetic_pipeline:
enabled: true
paths:
# Put additional paths here in order
# in which you want pipelined assets should
# be searched
- - %kernel.project_dir%/public
- - %kernel.root_dir%/vendor/assets
+ - %kernel.project_dir%/Resources/public
+ - %kernel.project_root%/vendor/assets
# By default, pipeline will search for assets inside
# every bundle too (paths section have higher priority though)
View
7 ...keleton/config/monolog/bundles/config.yml → Resources/skeleton/config/monolog/config.yml
@@ -42,3 +42,10 @@ dev:
firephp:
type: firephp
level: info
+
+test:
+ handlers:
+ main:
+ type: stream
+ path: %kernel.logs_dir%/%kernel.environment%.log
+ level: debug
View
0 ...eleton/config/security/bundles/config.yml → ...urces/skeleton/config/security/config.yml
File renamed without changes.
View
0 ...of_doctrine_extensions/bundles/config.yml → ...onfig/stof_doctrine_extensions/config.yml
File renamed without changes.
View
0 ...ton/config/swiftmailer/bundles/config.yml → ...es/skeleton/config/swiftmailer/config.yml
File renamed without changes.
View
0 ...s/skeleton/config/twig/bundles/config.yml → Resources/skeleton/config/twig/config.yml
File renamed without changes.
View
0 ...on/config/web_profiler/bundles/config.yml → ...s/skeleton/config/web_profiler/config.yml
File renamed without changes.
View
0 Resources/skeleton/project/config/kernel.yml → Resources/skeleton/project/app/kernel.yml
File renamed without changes.
View
2 Routing/Loader/AppBundleLoader.php
@@ -51,7 +51,7 @@ public function load($file, $type = null)
$collection = new RouteCollection();
foreach ($this->kernel->getBundle('App', false) as $bundle) {
- if (file_exists($routing = $bundle->getPath().'/config/routing.yml')) {
+ if (file_exists($routing = $bundle->getPath().'/Resources/config/routing.yml')) {
$collection->addCollection(parent::load($routing));
$collection->addResource(new FileResource($routing));
}
View
51 Templating/TemplateNameParser.php
@@ -1,51 +0,0 @@
-<?php
-
-/*
- * This file is part of the KnpRadBundle package.
- *
- * (c) KnpLabs <http://knplabs.com/>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Knp\Bundle\RadBundle\Templating;
-
-use Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser as BaseNameParser;
-
-use Knp\Bundle\RadBundle\Bundle\ApplicationBundle;
-use Symfony\Component\Templating\TemplateReferenceInterface;
-
-/**
- * Extends basic name parser with application bundle short notation.
- */
-class TemplateNameParser extends BaseNameParser
-{
- /**
- * {@inheritdoc}
- */
- public function parse($name)
- {
- if ($name instanceof TemplateReferenceInterface) {
- return $name;
- }
- if (isset($this->cache[$name])) {
- return $this->cache[$name];
- }
-
- $parsed = parent::parse($name);
-
- // if application bundle - use custom structure reference
- if ('App' === $parsed->get('bundle')) {
- return $this->cache[$name] = new TemplateReference(
- $parsed->get('bundle'),
- $parsed->get('controller'),
- $parsed->get('name'),
- $parsed->get('format'),
- $parsed->get('engine')
- );
- }
-
- return $parsed;
- }
-}
View
32 Templating/TemplateReference.php
@@ -1,32 +0,0 @@
-<?php
-
-/*
- * This file is part of the KnpRadBundle package.
- *
- * (c) KnpLabs <http://knplabs.com/>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-namespace Knp\Bundle\RadBundle\Templating;
-
-use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference as BaseReference;
-
-/**
- * Extends basic template reference with application bundle short notation.
- */
-class TemplateReference extends BaseReference
-{
- /**
- * {@inheritdoc}
- */
- public function getPath()
- {
- $controller = str_replace('\\', '/', $this->get('controller'));
-
- $path = (empty($controller) ? '' : $controller.'/').$this->get('name').'.'.$this->get('format').'.'.$this->get('engine');
-
- return empty($this->parameters['bundle']) ? 'views/'.$path : '@'.$this->get('bundle').'/views/'.$path;
- }
-}
View
27 Tests/DependencyInjection/Extension/AppExtensionTest.php
@@ -5,7 +5,6 @@
class AppExtensionTest extends \PHPUnit_Framework_TestCase
{
private $container;
- private $xmlLoader;
private $ymlLoader;
protected function setUp()
@@ -14,12 +13,8 @@ protected function setUp()
'Symfony\Component\DependencyInjection\ContainerBuilder'
)->disableOriginalConstructor()->getMock();
- $this->xmlLoader = $this->getMockBuilder(
- 'Symfony\Component\DependencyInjection\Loader\XmlFileLoader'
- )->disableOriginalConstructor()->getMock();
-
$this->ymlLoader = $this->getMockBuilder(
- 'Symfony\Component\DependencyInjection\Loader\XmlFileLoader'
+ 'Symfony\Component\DependencyInjection\Loader\YamlFileLoader'
)->disableOriginalConstructor()->getMock();
}
@@ -40,10 +35,6 @@ public function testLoadConfigs()
array('key.number.2' => 'val2')
);
- $this->xmlLoader
- ->expects($this->exactly(0))
- ->method('load');
-
$this->ymlLoader
->expects($this->exactly(0))
->method('load');
@@ -53,18 +44,13 @@ public function testLoadConfigs()
public function testLoadSingleServiceResource()
{
- $extension = $this->createExtension(__DIR__.'/fixtures/single');
+ $extension = $this->createExtension(__DIR__.'/fixtures');
$configs = array();
- $this->xmlLoader
- ->expects($this->once())
- ->method('load')
- ->with(__DIR__.'/fixtures/single/config/services.xml');
-
$this->ymlLoader
->expects($this->once())
->method('load')
- ->with(__DIR__.'/fixtures/single/config/services.yml');
+ ->with('services.yml');
$extension->load($configs, $this->container);
}
@@ -74,17 +60,12 @@ protected function createExtension($path)
$extension = $this->getMockBuilder(
'Knp\Bundle\RadBundle\DependencyInjection\Extension\AppExtension'
)
- ->setMethods(array('getXmlFileLoader', 'getYamlFileLoader'))
+ ->setMethods(array('getYamlFileLoader'))
->setConstructorArgs(array($path))
->getMock();
$extension
->expects($this->any())
- ->method('getXmlFileLoader')
- ->with($this->container)
- ->will($this->returnValue($this->xmlLoader));
- $extension
- ->expects($this->any())
->method('getYamlFileLoader')
->with($this->container)
->will($this->returnValue($this->ymlLoader));
View
0 ...nsion/fixtures/single/config/services.yml → ...on/fixtures/Resources/config/services.yml
File renamed without changes.
View
0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/one.xml
No changes.
View
0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/services.yml
No changes.
View
0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/services_two.yml
No changes.
View
0 Tests/DependencyInjection/Extension/fixtures/multiple/config/services/two.xml
No changes.
View
0 Tests/DependencyInjection/Extension/fixtures/single/config/services.xml
No changes.
View
2 Tests/Routing/Loader/AppBundleLoaderTest.php
@@ -38,7 +38,7 @@ protected function setUp()
public function testLoadSingleRouteFile()
{
- $this->bundle->path = __DIR__.'/Fixtures/single';
+ $this->bundle->path = __DIR__.'/Fixtures';
$collection = $this->loader->load('.')->all();
$this->assertCount(2, $collection);
View
0 ...Loader/Fixtures/single/config/routing.yml → ...der/Fixtures/Resources/config/routing.yml
File renamed without changes.
View
3 Tests/Routing/Loader/Fixtures/multiple/config/routing/routes1.yml
@@ -1,3 +0,0 @@
-article_show:
- pattern: /articles/{slug}
- defaults: { _controller: AcmeBlogBundle:Article:show }
View
3 Tests/Routing/Loader/Fixtures/multiple/config/routing/routes2.yml
@@ -1,3 +0,0 @@
-article_edit:
- pattern: /articles/{slug}/edit
- defaults: { _controller: AcmeBlogBundle:Article:edit }
View
4 bin/generate-rad-project
@@ -26,9 +26,9 @@ $skeletonPath = dirname($bundleRefl->getFilename()).'/Resources/skeleton';
$fs = new Filesystem();
$fs->mirror($skeletonPath.'/project', $projectPath);
-$kernel = file_get_contents($projectPath.'/config/kernel.yml');
+$kernel = file_get_contents($projectPath.'/app/kernel.yml');
$kernel = str_replace('{{ project }}', $projectName, $kernel);
-file_put_contents($projectPath.'/config/kernel.yml', $kernel);
+file_put_contents($projectPath.'/app/kernel.yml', $kernel);
$fs->mirror($skeletonPath.'/application', $applicationPath);
$fs->chmod(array(

0 comments on commit 201cea9

Please sign in to comment.