Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Proof of concept of bundle generator #684

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

bdunogier
Copy link
Member

@bdunogier bdunogier commented Oct 6, 2016

Implements a PlatformUI bundle generator. Generates a structure similar to https://raw.githubusercontent.com/dpobel/PlatformUIExtensionSkeletonBundle, in order to kickstart the development of any PlatformUI extension.

php app/console generate:ez:platform-ui-plugin

Only supported format is yml at the moment.

TODO

  • support XML and PHP configuration formats
  • Fill in the TODO list
  • Check if the generated code actually works as expected
  • Exclude .php.twig files from CS check

@ezrobot
Copy link

ezrobot commented Oct 7, 2016

This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

Loaded config from "/jenkins/jenkins.std/jobs/PlatformUIBundle-Pull-Request-checker/workspace/.php_cs"
F
Legend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error
   1) Resources/SensioGeneratorBundle/skeleton/bundle/Configuration.php.twig (phpdoc_indent, phpdoc_short_description, operators_spaces, single_line_after_imports, phpdoc_trim, braces)
      ---------- begin diff ----------
      --- Original
      +++ New
      @@ @@
       <?php

       namespace {{ namespace }}\DependencyInjection;

      -{% block use_statements %}
      +{ % block use_statements % }
       use Symfony\Component\Config\Definition\Builder\TreeBuilder;
       use Symfony\Component\Config\Definition\ConfigurationInterface;
      -{% endblock use_statements %}

      +{ % endblock use_statements % }
      +
       /**
      -{% block phpdoc_class_header %}
      - * This is the class that validates and merges configuration from your app/config files
      -{% endblock phpdoc_class_header %}
      + * This is the class that validates and merges configuration from your app/config files.
      + {% endblock phpdoc_class_header %}
        *
        * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
        */
      -{% block class_definition %}
      +{ % block class_definition % }
       class Configuration implements ConfigurationInterface
      -{% endblock class_definition %}
       {
      -{% block class_body %}
      +    % endblock class_definition %
      +}
      +{
      +{ % block class_body % }

      @@ @@
           }
      -{% endblock class_body %}
      +{ % endblock class_body % }
       }


      ---------- end diff ----------

Fixed all files in 7.179 seconds, 6.500 MB memory used

@bdunogier
Copy link
Member Author

I expected e56aa10 to fix php-cs, but it doesn't seem so...

@ezrobot
Copy link

ezrobot commented Oct 7, 2016

This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

Loaded config from "/jenkins/jenkins.std/jobs/PlatformUIBundle-Pull-Request-checker/workspace/.php_cs"
.F
Legend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error
   1) Resources/SensioGeneratorBundle/skeleton/bundle/Configuration.php.twig (phpdoc_indent, phpdoc_short_description, operators_spaces, single_line_after_imports, phpdoc_trim, braces)
      ---------- begin diff ----------
      --- Original
      +++ New
      @@ @@
       <?php

       namespace {{ namespace }}\DependencyInjection;

      -{% block use_statements %}
      +{ % block use_statements % }
       use Symfony\Component\Config\Definition\Builder\TreeBuilder;
       use Symfony\Component\Config\Definition\ConfigurationInterface;
      -{% endblock use_statements %}

      +{ % endblock use_statements % }
      +
       /**
      -{% block phpdoc_class_header %}
      - * This is the class that validates and merges configuration from your app/config files
      -{% endblock phpdoc_class_header %}
      + * This is the class that validates and merges configuration from your app/config files.
      + {% endblock phpdoc_class_header %}
        *
        * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
        */
      -{% block class_definition %}
      +{ % block class_definition % }
       class Configuration implements ConfigurationInterface
      -{% endblock class_definition %}
       {
      -{% block class_body %}
      +    % endblock class_definition %
      +}
      +{
      +{ % block class_body % }

      @@ @@
           }
      -{% endblock class_body %}
      +{ % endblock class_body % }
       }


      ---------- end diff ----------

Fixed all files in 1.907 seconds, 6.500 MB memory used

@dpobel
Copy link
Contributor

dpobel commented Oct 7, 2016

awesome :) I'll try to test that shortly

@yannickroger
Copy link
Contributor

Great idea 😃

@ezrobot
Copy link

ezrobot commented Oct 11, 2016

This Pull Request does not respect PSR-2 Coding Standards, please, see the suggested diff below:

Loaded config from "/jenkins/jenkins.std/jobs/PlatformUIBundle-Pull-Request-checker/workspace/.php_cs"
F.......F.
Legend: ?-unknown, I-invalid file syntax, file ignored, .-no changes, F-fixed, E-error
   1) Generator/PlatformUIPluginGenerator.php (concat_with_spaces)
      ---------- begin diff ----------
      --- Original
      +++ New
      @@ @@
               $this->renderFile('bundle/Configuration.php.twig', $dir . '/DependencyInjection/Configuration.php', $parameters);
      -        $this->renderFile('bundle/DefaultController.php.twig', $dir.'/Controller/DefaultController.php', $parameters);
      -        $this->renderFile('bundle/DefaultControllerTest.php.twig', $dir.'/Tests/Controller/DefaultControllerTest.php', $parameters);
      +        $this->renderFile('bundle/DefaultController.php.twig', $dir . '/Controller/DefaultController.php', $parameters);
      +        $this->renderFile('bundle/DefaultControllerTest.php.twig', $dir . '/Tests/Controller/DefaultControllerTest.php', $parameters);

               if ('annotation' != $format) {
      -            $this->renderFile('bundle/routing.'.$format.'.twig', $dir.'/Resources/config/routing.'.$format, $parameters);
      +            $this->renderFile('bundle/routing.' . $format . '.twig', $dir . '/Resources/config/routing.' . $format, $parameters);
               }

               if ($structure) {
                   $this->renderFile('bundle/messages.fr.xlf', $dir . '/Resources/translations/messages.fr.xlf', $parameters);

                   $this->filesystem->mkdir($dir . '/Resources/doc');
                   $this->filesystem->touch($dir . '/Resources/doc/index.rst');
                   $this->filesystem->mkdir($dir . '/Resources/translations');
                   $this->filesystem->mkdir($dir . '/Resources/public/css');
                   $this->filesystem->mkdir($dir . '/Resources/public/images');
                   $this->filesystem->mkdir($dir . '/Resources/public/js');
               }
           }
       }


      ---------- end diff ----------

   2) Resources/SensioGeneratorBundle/skeleton/bundle/Configuration.php.twig (phpdoc_indent, phpdoc_short_description, operators_spaces, single_line_after_imports, phpdoc_trim, braces)
      ---------- begin diff ----------
      --- Original
      +++ New
      @@ @@
       <?php

       namespace {{ namespace }}\DependencyInjection;

      -{% block use_statements %}
      +{ % block use_statements % }
       use Symfony\Component\Config\Definition\Builder\TreeBuilder;
       use Symfony\Component\Config\Definition\ConfigurationInterface;
      -{% endblock use_statements %}

      +{ % endblock use_statements % }
      +
       /**
      -{% block phpdoc_class_header %}
      - * This is the class that validates and merges configuration from your app/config files
      -{% endblock phpdoc_class_header %}
      + * This is the class that validates and merges configuration from your app/config files.
      + {% endblock phpdoc_class_header %}
        *
        * To learn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class}
        */
      -{% block class_definition %}
      +{ % block class_definition % }
       class Configuration implements ConfigurationInterface
      -{% endblock class_definition %}
       {
      -{% block class_body %}
      +    % endblock class_definition %
      +}
      +{
      +{ % block class_body % }

      @@ @@
           }
      -{% endblock class_body %}
      +{ % endblock class_body % }
       }


      ---------- end diff ----------

Fixed all files in 2.691 seconds, 6.750 MB memory used

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

4 participants