@@ -241,116 +241,6 @@ public static function removeSymfonyStandardFiles(CommandEvent $event)
241241 $ fs ->remove ($ appDir .'/SymfonyStandard ' );
242242 }
243243
244- public static function installAcmeDemoBundle (CommandEvent $ event )
245- {
246- $ rootDir = getcwd ();
247- $ options = static ::getOptions ($ event );
248-
249- if (file_exists ($ rootDir .'/src/Acme/DemoBundle ' )) {
250- return ;
251- }
252-
253- if (!getenv ('SENSIOLABS_FORCE_ACME_DEMO ' )) {
254- if (!$ event ->getIO ()->askConfirmation ('Would you like to install Acme demo bundle? [y/N] ' , false )) {
255- return ;
256- }
257- }
258-
259- $ event ->getIO ()->write ('Installing the Acme demo bundle. ' );
260-
261- $ appDir = $ options ['symfony-app-dir ' ];
262-
263- $ kernelFile = $ appDir .'/AppKernel.php ' ;
264-
265- $ fs = new Filesystem ();
266- $ fs ->mirror (__DIR__ .'/../Resources/skeleton/acme-demo-bundle ' , $ rootDir .'/src ' , null , array ('override ' => true ));
267-
268- $ ref = '$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle(); ' ;
269- $ bundleDeclaration = "\$bundles[] = new Acme \\DemoBundle \\AcmeDemoBundle(); " ;
270- $ content = file_get_contents ($ kernelFile );
271-
272- if (false === strpos ($ content , $ bundleDeclaration )) {
273- $ updatedContent = str_replace ($ ref , $ bundleDeclaration ."\n " .$ ref , $ content );
274- if ($ content === $ updatedContent ) {
275- throw new \RuntimeException ('Unable to patch %s. ' , $ kernelFile );
276- }
277- $ fs ->dumpFile ($ kernelFile , $ updatedContent );
278- }
279-
280- static ::patchAcmeDemoBundleConfiguration ($ appDir , $ fs );
281- }
282-
283- private static function patchAcmeDemoBundleConfiguration ($ appDir , Filesystem $ fs )
284- {
285- $ routingFile = $ appDir .'/config/routing_dev.yml ' ;
286- $ securityFile = $ appDir .'/config/security.yml ' ;
287-
288- $ routingData = file_get_contents ($ routingFile ).<<<EOF
289-
290- # AcmeDemoBundle routes (to be removed)
291- _acme_demo:
292- resource: "@AcmeDemoBundle/Resources/config/routing.yml"
293- EOF ;
294- $ fs ->dumpFile ($ routingFile , $ routingData );
295-
296- $ securityData = <<<EOF
297- # you can read more about security in the related section of the documentation
298- # http://symfony.com/doc/current/book/security.html
299- security:
300- # http://symfony.com/doc/current/book/security.html#encoding-the-user-s-password
301- encoders:
302- Symfony\Component\Security\Core\User\User: plaintext
303-
304- # http://symfony.com/doc/current/book/security.html#hierarchical-roles
305- role_hierarchy:
306- ROLE_ADMIN: ROLE_USER
307- ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
308-
309- # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers
310- providers:
311- in_memory:
312- memory:
313- users:
314- user: { password: userpass, roles: [ 'ROLE_USER' ] }
315- admin: { password: adminpass, roles: [ 'ROLE_ADMIN' ] }
316-
317- # the main part of the security, where you can set up firewalls
318- # for specific sections of your app
319- firewalls:
320- # disables authentication for assets and the profiler, adapt it according to your needs
321- dev:
322- pattern: ^/(_(profiler|wdt)|css|images|js)/
323- security: false
324- # the login page has to be accessible for everybody
325- demo_login:
326- pattern: ^/demo/secured/login$
327- security: false
328-
329- # secures part of the application
330- demo_secured_area:
331- pattern: ^/demo/secured/
332- # it's important to notice that in this case _demo_security_check and _demo_login
333- # are route names and that they are specified in the AcmeDemoBundle
334- form_login:
335- check_path: _demo_security_check
336- login_path: _demo_login
337- logout:
338- path: _demo_logout
339- target: _demo
340- #anonymous: ~
341- #http_basic:
342- # realm: "Secured Demo Area"
343-
344- # with these settings you can restrict or allow access for different parts
345- # of your application based on roles, ip, host or methods
346- # http://symfony.com/doc/current/cookbook/security/access_control.html
347- access_control:
348- #- { path: ^/login, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https }
349- EOF ;
350-
351- $ fs ->dumpFile ($ securityFile , $ securityData );
352- }
353-
354244 public static function doBuildBootstrap ($ bootstrapDir , $ autoloadDir = null , $ useNewDirectoryStructure = false )
355245 {
356246 $ file = $ bootstrapDir .'/bootstrap.php.cache ' ;
@@ -398,7 +288,7 @@ public static function doBuildBootstrap($bootstrapDir, $autoloadDir = null, $use
398288
399289 if ($ useNewDirectoryStructure ) {
400290 $ cacheDir = $ fs ->makePathRelative ($ bootstrapDir , $ autoloadDir );
401- $ bootstrapContent = str_replace (array ("return \$this->rootDir.'/logs " , "return \$this->rootDir.'/cache " ), array ("return \$this->rootDir.'/ " .$ cacheDir ." logs " , "return \$this->rootDir.'/ " .$ cacheDir ." cache " ), $ bootstrapContent );
291+ $ bootstrapContent = str_replace (array ("return \$this->rootDir.'/logs " , "return \$this->rootDir.'/cache " ), array ("return \$this->rootDir.'/ " .$ cacheDir .' logs ' , "return \$this->rootDir.'/ " .$ cacheDir .' cache ' ), $ bootstrapContent );
402292 }
403293
404294 if ($ autoloadDir ) {
@@ -505,7 +395,7 @@ protected static function updateDirectoryStructure(CommandEvent $event, $rootDir
505395 </php>
506396EOF ;
507397 $ phpunit = str_replace (array ('<directory>../src ' , '"bootstrap.php.cache" ' , $ phpunitKernelBefore ), array ('<directory>src ' , '" ' .$ varDir .'/bootstrap.php.cache" ' , $ phpunitKernelAfter ), file_get_contents ($ rootDir .'/phpunit.xml.dist ' ));
508- $ composer = str_replace ("\" symfony-app-dir \ ": \ "app \" , " , "\"symfony-app-dir \": \"app \", \n \"symfony-bin-dir \": \"bin \", \n \"symfony-var-dir \": \"var \", " , file_get_contents ($ rootDir .'/composer.json ' ));
398+ $ composer = str_replace (' " symfony-app-dir": "app", ' , "\"symfony-app-dir \": \"app \", \n \"symfony-bin-dir \": \"bin \", \n \"symfony-var-dir \": \"var \", " , file_get_contents ($ rootDir .'/composer.json ' ));
509399
510400 $ fs ->dumpFile ($ webDir .'/app.php ' , str_replace ($ appDir .'/bootstrap.php.cache ' , $ varDir .'/bootstrap.php.cache ' , file_get_contents ($ webDir .'/app.php ' )));
511401 $ fs ->dumpFile ($ webDir .'/app_dev.php ' , str_replace ($ appDir .'/bootstrap.php.cache ' , $ varDir .'/bootstrap.php.cache ' , file_get_contents ($ webDir .'/app_dev.php ' )));
0 commit comments