From 746eeac4b8a0b3393c156e711c2b90ff3f6636ee Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 12 Oct 2017 09:32:44 +0200 Subject: [PATCH 01/39] current work, first dispatch on seo-bundle --- .travis.yml | 2 +- config/dev-kit.yml | 95 +++-- config/projects.yml | 415 +----------------- project/.github/ISSUE_TEMPLATE.md | 17 +- project/.github/PULL_REQUEST_TEMPLATE.md | 68 +-- project/.php_cs | 40 -- project/.styleci.yml | 35 +- project/.travis.yml.twig | 103 ++--- project/.travis/after_success_test.sh | 4 - project/.travis/before_install_test.sh.twig | 34 -- project/.travis/before_script_test.sh.twig | 12 - project/.travis/check_relevant_docs.sh | 6 - project/.travis/check_relevant_lint.sh | 6 - project/.travis/check_relevant_test.sh | 6 - project/.travis/install_docs.sh.twig | 4 - project/.travis/install_lint.sh | 6 - project/.travis/install_test.sh | 24 -- project/CONTRIBUTING.md | 444 +------------------- project/LICENSE | 21 - project/Makefile | 50 ++- project/README.md | 65 ++- project/src/Resources/meta/LICENSE | 23 + src/Config/ProjectsConfiguration.php | 11 +- src/Console/Command/AbstractCommand.php | 13 +- src/Console/Command/DependsCommand.php | 2 +- src/Console/Command/DispatchCommand.php | 143 +++---- 26 files changed, 326 insertions(+), 1323 deletions(-) delete mode 100644 project/.php_cs delete mode 100755 project/.travis/after_success_test.sh delete mode 100755 project/.travis/before_install_test.sh.twig delete mode 100644 project/.travis/before_script_test.sh.twig delete mode 100755 project/.travis/check_relevant_docs.sh delete mode 100755 project/.travis/check_relevant_lint.sh delete mode 100755 project/.travis/check_relevant_test.sh delete mode 100755 project/.travis/install_docs.sh.twig delete mode 100755 project/.travis/install_lint.sh delete mode 100755 project/.travis/install_test.sh delete mode 100644 project/LICENSE create mode 100644 project/src/Resources/meta/LICENSE diff --git a/.travis.yml b/.travis.yml index d0b8f1555..42d40f7dc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ branches: language: php -php: 5.5 +php: 7.1 sudo: false diff --git a/config/dev-kit.yml b/config/dev-kit.yml index 7805ab1e7..dbdf08154 100644 --- a/config/dev-kit.yml +++ b/config/dev-kit.yml @@ -1,53 +1,70 @@ labels: - - name: patch + # describe priority + - name: 'patch' color: '207de5' - - name: minor + - name: 'minor' color: '009800' - - name: major + - name: 'major' color: 'e11d21' - - name: pedantic + - name: 'pedantic' color: 'd1e4fa' - - name: enhancement - color: '02d7e1' - - name: feature - color: '02e10c' - - name: bug + - name: 'bug' color: 'fc2929' - - name: unconfirmed - color: '444444' - - name: critical + - name: 'critical' color: 'fc2929' - - name: vendor + + # state on a board + - name: 'in progress' + color: 'ededed' + - name: 'review' color: 'ededed' - - name: pending author + - name: 'wip/poc' color: 'ededed' - - name: in progress + - name: 'ready' color: 'ededed' - - name: RTM - color: 'ffffff' - - name: docs - color: 'fbca04' - - name: help wanted - color: '0e8a16' - - name: Easy Pick + - name: 'won`t fix' + color: 'ededed' + + # issue classes + - name: 'help wanted' + color: '128A0C' + - name: 'good first issue' + color: '5319e7' + - name: 'question' + color: 'cc317c' + - name: 'Easy Pick' color: 'd7e102' - - name: 'Needs: Documentation' - color: '006b75' - - name: 'Needs: Tests' - color: '006b75' - - name: 'Needs: Changelog note' - color: '006b75' - - name: 'Needs: Upgrade note' - color: '006b75' - - name: 'hacktoberfest' - color: 'b0581d' + - name: 'DX' + color: '5319e7' + - name: 'UX' + color: '19E791' + color: '333333' + - name: 'discussion' + color: 'cc317c' + - name: 'enhancement' + color: '02d7e1' + - name: 'feature' + color: '207de5' + - name: 'nice to have' + color: '0052cc' + + # persistence layer + - name: 'ORM' + color: 'bfd4f2' + - name: 'PHPCR' + color: 'bfd4f2' + + # else + - name: 'pending author' + color: 'ededed' + - name: 'blocked' + color: 'cccccc' + - name: 'duplicate' + color: 'cccccc' packages: symfony: symfony/symfony - fos_user: friendsofsymfony/user-bundle - sonata_core: sonata-project/core-bundle - sonata_admin: sonata-project/admin-bundle - sonata_block: sonata-project/block-bundle - sonata_user: sonata-project/user-bundle - ruflin_elastica: ruflin/elastica - doctrine_odm: doctrine/mongodb-odm + core_bundle: symfony-cmf/core-bundle + website: symfony-cmf/symfony-cmf-website + seo_bundle: symfony-cmf/seo-bundle + diff --git a/config/projects.yml b/config/projects.yml index 1f930648e..6f976a58f 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -1,411 +1,16 @@ -admin-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_block: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_block: ['3'] - -admin-search-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8'] - sonata_admin: ['3'] - ruflin_elastica: ['2'] - 1.x: - php: ['5.6', '7.0'] - versions: - symfony: ['2.8'] - sonata_admin: ['3'] - ruflin_elastica: ['2'] - -article-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - -block-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - # https://travis-ci.org/sonata-project/SonataBlockBundle/jobs/131844587#L222 - #sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - # This has to be resolved: https://travis-ci.org/sonata-project/SonataBlockBundle/jobs/130298942#L230 - #sonata_admin: ['3'] - -cache: - excluded_files: - - README.md - docs_target: false - branches: - master: - php: ['7.1'] - 1.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - -cache-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - -classification-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_admin: ['3'] - -classification-media-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - -comment-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8'] - sonata_core: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8'] - sonata_core: ['3'] - -core-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - -dashboard-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_block: ['3'] - -datagrid-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - -doctrine-extensions: - excluded_files: - - README.md - docs_target: false - branches: - master: - php: ['7.1'] - 1.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - -doctrine-mongodb-admin-bundle: - branches: - master: - php: ['5.6'] - services: [mongodb] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6'] - services: [mongodb] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_admin: ['3'] - -doctrine-orm-admin-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - -doctrine-phpcr-admin-bundle: - branches: - master: - # sonata 2 should still support php 5.6 to be consistent with the symfony cmf - php: ['5.6', '7.0', '7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_admin: ['3'] - sonata_block: ['3'] - 1.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8'] - -easy-extends-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - -ecommerce: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8'] - docs_path: docs - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8'] - docs_path: docs - -exporter: - excluded_files: - - README.md - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - doctrine_odm: ['1'] - services: [mongodb] - docs_path: docs - 1.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - target_php: 5.6 - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - doctrine_odm: ['1'] - services: [mongodb] - docs_path: docs - -formatter-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_block: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_block: ['3'] - -google-authenticator: - excluded_files: - - README.md - docs_target: false - branches: - master: - php: ['7.1'] - 2.x: - php: ['7.0', '7.1'] - 1.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - -intl-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_user: ['3'] - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_user: ['3'] - -media-bundle: - branches: - master: - php: ['7.1'] - services: [mongodb] - versions: - symfony: ['2.8', '3.2', '3.3'] - doctrine_odm: ['1'] - sonata_core: ['3'] - sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - services: [mongodb] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - doctrine_odm: ['1'] - sonata_core: ['3'] - sonata_admin: ['3'] - -news-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_user: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_user: ['3'] - -notification-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - -page-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_block: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_block: ['3'] - -propel-admin-bundle: ~ - -sandbox: ~ - seo-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_block: ['3'] - sonata_admin: ['3'] - 2.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_block: ['3'] - sonata_admin: ['3'] + description: | + "This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) + and licensed under the [MIT License](LICENSE). -timeline-bundle: + It provides a solution to make content bundles + aware for Search Engine Optimisation (SEO)." branches: master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_block: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - sonata_block: ['3'] - -translation-bundle: - branches: - master: - php: ['7.1'] - versions: - symfony: ['2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - 2.x: - php: ['5.4', '5.5', '5.6', '7.0', '7.1'] - versions: - symfony: ['2.3', '2.7', '2.8', '3.2', '3.3'] - sonata_core: ['3'] - sonata_admin: ['3'] - -user-bundle: - branches: - master: - php: ['7.1'] + php: ['5.6', '7.0', '7.1'] versions: - symfony: ['2.8', '3.2', '3.3'] - fos_user: ['2'] - sonata_core: ['3'] - sonata_admin: ['3'] - 3.x: - php: ['5.3', '5.4', '5.5', '5.6', '7.0', '7.1'] + symfony: ['2.8', '3.1', '3.2', '3.3'] + "2.0": + php: ['5.6', '7.0', '7.1'] versions: - symfony: ['2.3', '2.7', '2.8'] - fos_user: ['1.3'] - sonata_core: ['3'] - sonata_admin: ['3'] + symfony: ['2.8', '3.1', '3.2', '3.3'] diff --git a/project/.github/ISSUE_TEMPLATE.md b/project/.github/ISSUE_TEMPLATE.md index 0d504535f..2b835bc94 100644 --- a/project/.github/ISSUE_TEMPLATE.md +++ b/project/.github/ISSUE_TEMPLATE.md @@ -10,23 +10,10 @@ ### Environment -#### Sonata packages - -``` -$ composer show --latest 'sonata-project/*' -``` - #### Symfony packages ``` -$ composer show --latest 'symfony/*' -``` - -#### PHP version - -``` -$ php -v -# Put the result here. +$ composer show --latest 'symfony-cmf/*' ``` ## Subject @@ -46,5 +33,5 @@ $ php -v If it's an error message or piece of code, use code block tags, and make sure you provide the whole stack trace(s), not just the first error message you can see. - More details here: https://github.com/sonata-project/{{ repository_name }}/blob/{{ stable_branch }}/CONTRIBUTING.md#issues + More details here: https://github.com/symfony-cmf/{{ repository_name }}/blob/{{ stable_branch }}/CONTRIBUTING.md#issues --> diff --git a/project/.github/PULL_REQUEST_TEMPLATE.md b/project/.github/PULL_REQUEST_TEMPLATE.md index dc76dc5aa..0d8f7f77b 100644 --- a/project/.github/PULL_REQUEST_TEMPLATE.md +++ b/project/.github/PULL_REQUEST_TEMPLATE.md @@ -1,58 +1,10 @@ - - - -I am targeting this branch, because {reason}. - -In case of bug fix, `{{ legacy_branch }}` **MUST** be targeted. - - - -Closes #{put_issue_number_here} - -## Changelog - - - - -```markdown -### Added -- Added some `Class::newMethod` to do great stuff - -### Changed - -### Deprecated - -### Removed - -### Fixed - -### Security -``` - -## To do - - - -- [ ] Update the tests -- [ ] Update the documentation -- [ ] Add an upgrade note - -## Subject - - +| Q | A +| ------------- | --- +| Branch? | "master" for new features / the branch of the current release for fixes +| Bug fix? | yes/no +| New feature? | yes/no +| BC breaks? | yes/no +| Deprecations? | yes/no +| Fixed tickets | comma-separated list of tickets fixed by the PR, if any +| License | MIT +| Doc PR | reference to the documentation PR, if any diff --git a/project/.php_cs b/project/.php_cs deleted file mode 100644 index dcd9cd1b7..000000000 --- a/project/.php_cs +++ /dev/null @@ -1,40 +0,0 @@ - - -For the full copyright and license information, please view the LICENSE -file that was distributed with this source code. -EOF; - -// PHP-CS-Fixer 1.x -if (class_exists('Symfony\CS\Fixer\Contrib\HeaderCommentFixer')) { - \Symfony\CS\Fixer\Contrib\HeaderCommentFixer::setHeader($header); -} - -$config = ConfigBridge::create() - ->setUsingCache(true) -; - -// PHP-CS-Fixer 2.x -if (method_exists($config, 'setRules')) { - $config->setRules(array_merge($config->getRules(), array( - 'header_comment' => array('header' => $header) - ))); -} - -return $config; diff --git a/project/.styleci.yml b/project/.styleci.yml index b92598db3..6d1247d86 100644 --- a/project/.styleci.yml +++ b/project/.styleci.yml @@ -1,30 +1,21 @@ # DO NOT EDIT THIS FILE! # -# It's auto-generated by sonata-project/dev-kit package. -# -# Package `sllh/php-cs-fixer-styleci-bridge` is required to get it working. +# It's auto-generated by symfony-cmf/dev-kit package. + +############################################################################ +# This file is part of the Symfony CMF package. # +# # +# (c) 2011-2017 Symfony CMF # +# # +# For the full copyright and license information, please view the LICENSE # +# file that was distributed with this source code. # +############################################################################ + preset: symfony enabled: - - class_keyword_remove - - combine_consecutive_unsets - - long_array_syntax - - newline_after_open_tag - - no_php4_constructor - - no_useless_else - - ordered_class_elements - ordered_use -# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results -# - strict -# - strict_param -# - php_unit_construct -# - php_unit_strict + - short_array_syntax -finder: - exclude: - - 'Tests/Fixtures' - # ecommerce special case: - - 'Resources/skeleton' - # ignore vendor assets - - 'Resources/public/vendor' +disabled: [single_line_class_definition] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 5d254e3ee..ea2713bcc 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -1,94 +1,63 @@ # DO NOT EDIT THIS FILE! # -# It's auto-generated by sonata-project/dev-kit package. +# It's auto-generated by symfony-cmf/dev-kit package. -branches: - only: -{% for branch in branches|keys %} - - {{ branch }} -{% endfor %} +############################################################################ +# This file is part of the Symfony CMF package. # +# # +# (c) 2011-2017 Symfony CMF # +# # +# For the full copyright and license information, please view the LICENSE # +# file that was distributed with this source code. # +############################################################################ language: php php: -{% for version in php %} - - '{{ version }}' -{% endfor %} - - nightly - -{% if services is not empty %} -services: -{% for service in services %} - - {{ service }} -{% endfor %} + - 7.0 -{% endif %} sudo: false -dist: precise cache: - pip: true directories: + - .phpunit - $HOME/.composer/cache/files env: + matrix: SYMFONY_VERSION=3.2.* global: - - PATH="$HOME/.local/bin:$PATH" - - SYMFONY_DEPRECATIONS_HELPER=weak - - TARGET=test - - UPSTREAM_URL=https://github.com/sonata-project/{{ repository_name }}.git - - XMLLINT_INDENT=" " + - SYMFONY_DEPRECATIONS_HELPER=48 + - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" SYMFONY_PHPUNIT_VERSION=5.7 matrix: - fast_finish: true include: -{% if docs_target %} - - php: '{{ php|last }}' - env: TARGET=docs -{% endif %} -{% if docs_target %} - - php: '{{ php|last }}' - env: TARGET=lint -{% endif %} - - php: '{{ php|first }}' - env: COMPOSER_FLAGS="--prefer-lowest" -{% for package_name,package_versions in versions %} -{% for version in package_versions %} - - php: '{{ target_php|default(php|last) }}' - env: {{ package_name|upper }}={{ version }}.* -{% endfor %} -{% if package_versions|length > 0 %} - - php: '{{ target_php|default(php|last) }}' - env: {{ package_name|upper }}=dev-master@dev -{% endif %} + - php: {{ php|last }} + env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* + - php: {{ php|first }} + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }}.* SYMFONY_DEPRECATIONS_HELPER=weak +{% for php_version in php if php_version != php|last and php_version != php|first %} +{% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} + - php: {{ php_version }} + env: SYMFONY={{ version }}.* {% endfor %} - - php: '{{ php|last }}' - env: SYMFONY_DEPRECATIONS_HELPER=0 - - php: hhvm - dist: trusty - allow_failures: - - php: nightly - - php: hhvm - - env: SYMFONY_DEPRECATIONS_HELPER=0 -{% for package_name,package_versions in versions %} -{% if package_versions|length > 0 %} - - env: {{ package_name|upper }}=dev-master@dev -{% endif %} {% endfor %} + - env: TEST_INSTALLATION=true + fast_finish: true before_install: - - git remote add upstream ${UPSTREAM_URL} && git fetch --all - - if [[ -x .travis/check_relevant_${TARGET}.sh && "$TRAVIS_PULL_REQUEST" != "false" ]]; then export RELEVANT=$(.travis/check_relevant_${TARGET}.sh); fi; - - if [[ ! -z ${RELEVANT} ]];then exit 0; fi; - - if [ -x .travis/before_install_${TARGET}.sh ]; then .travis/before_install_${TARGET}.sh; fi; + - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi + - phpenv config-rm xdebug.ini || true + - composer self-update + - if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi + - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi + - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) -install: - - if [ -x .travis/install_${TARGET}.sh ]; then .travis/install_${TARGET}.sh; fi; +install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS -before_script: - - if [ -x .travis/before_script_${TARGET}.sh ]; then .travis/before_script_${TARGET}.sh; fi; +before_script: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh -script: make $TARGET +script: + - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi -after_success: - - if [ -x .travis/after_success_${TARGET}.sh ]; then .travis/after_success_${TARGET}.sh; fi; +notifications: + irc: "irc.freenode.org#symfony-cmf" diff --git a/project/.travis/after_success_test.sh b/project/.travis/after_success_test.sh deleted file mode 100755 index 87158518b..000000000 --- a/project/.travis/after_success_test.sh +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -set -ev - -coveralls -v diff --git a/project/.travis/before_install_test.sh.twig b/project/.travis/before_install_test.sh.twig deleted file mode 100755 index 7fd389068..000000000 --- a/project/.travis/before_install_test.sh.twig +++ /dev/null @@ -1,34 +0,0 @@ -#!/usr/bin/env sh -set -ev - -if [ "${TRAVIS_PHP_VERSION}" != "hhvm" ]; then - PHP_INI_DIR="$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/" - TRAVIS_INI_FILE="$PHP_INI_DIR/travis.ini" - echo "memory_limit=3072M" >> "$TRAVIS_INI_FILE" - - {% if '5.3' in php %} - if [ "$TRAVIS_PHP_VERSION" '<' '5.4' ]; then - XDEBUG_INI_FILE="$PHP_INI_DIR/xdebug.ini" - if [ -f "$XDEBUG_INI_FILE" ]; then - mv "$XDEBUG_INI_FILE" /tmp - fi - fi - {% endif %} - - {% if 'mongodb' in services %} - if [ "$TRAVIS_PHP_VERSION" '<' '7.0' ]; then - echo "extension=mongo.so" >> "$TRAVIS_INI_FILE" - else - echo "extension=mongodb.so" >> "$TRAVIS_INI_FILE" - - # Backwards compatibility with old mongo extension - composer require "alcaeus/mongo-php-adapter" --no-update - fi - {% endif %} -fi - -sed --in-place "s/\"dev-master\":/\"dev-${TRAVIS_COMMIT}\":/" composer.json - -{% for package_name,package_versions in versions if package_versions|length > 0 %} -if [ "${{ package_name|upper }}" != "" ]; then composer require "{{ packages[package_name] }}:${{ package_name|upper }}" --no-update; fi; -{% endfor %} diff --git a/project/.travis/before_script_test.sh.twig b/project/.travis/before_script_test.sh.twig deleted file mode 100644 index 0d8684d69..000000000 --- a/project/.travis/before_script_test.sh.twig +++ /dev/null @@ -1,12 +0,0 @@ -#!/usr/bin/env bash -set -ev - -{% if '5.3' in php %} -if [ "$TRAVIS_PHP_VERSION" != "hhvm" ] && [ "$TRAVIS_PHP_VERSION" '<' '5.4' ]; then - PHP_INI_DIR="$HOME/.phpenv/versions/$(phpenv version-name)/etc/conf.d/" - XDEBUG_INI_FILE="/tmp/xdebug.ini" - if [ -f "$XDEBUG_INI_FILE" ]; then - mv "$XDEBUG_INI_FILE" "$PHP_INI_DIR" - fi -fi -{% endif %} diff --git a/project/.travis/check_relevant_docs.sh b/project/.travis/check_relevant_docs.sh deleted file mode 100755 index 9e618c4e2..000000000 --- a/project/.travis/check_relevant_docs.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -ev - -RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.rst') - -if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/project/.travis/check_relevant_lint.sh b/project/.travis/check_relevant_lint.sh deleted file mode 100755 index 42be76763..000000000 --- a/project/.travis/check_relevant_lint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -ev - -RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.json' '*.yml' '*.xml' '*.xliff') - -if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/project/.travis/check_relevant_test.sh b/project/.travis/check_relevant_test.sh deleted file mode 100755 index a4ad29036..000000000 --- a/project/.travis/check_relevant_test.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env bash -set -ev - -RELEVANT_FILES=$(git diff --name-only HEAD upstream/${TRAVIS_BRANCH} -- '*.php' '*.yml' '*.xml' '*.twig' '*.js' '*.css' '*.json') - -if [[ -z ${RELEVANT_FILES} ]]; then echo -n 'KO'; exit 0; fi; diff --git a/project/.travis/install_docs.sh.twig b/project/.travis/install_docs.sh.twig deleted file mode 100755 index ea1d81c48..000000000 --- a/project/.travis/install_docs.sh.twig +++ /dev/null @@ -1,4 +0,0 @@ -#!/usr/bin/env sh -set -ev - -pip install -r {{ docs_path }}/requirements.txt --user diff --git a/project/.travis/install_lint.sh b/project/.travis/install_lint.sh deleted file mode 100755 index ab8f0f390..000000000 --- a/project/.travis/install_lint.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -set -ev - -composer global require sllh/composer-lint:@stable --prefer-dist --no-interaction - -gem install yaml-lint diff --git a/project/.travis/install_test.sh b/project/.travis/install_test.sh deleted file mode 100755 index b15f8f875..000000000 --- a/project/.travis/install_test.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/usr/bin/env sh -set -ev - -mkdir --parents "${HOME}/bin" - -# PHPUnit install -if [ ${TRAVIS_PHP_VERSION} '<' '5.6' ]; then - PHPUNIT_PHAR=phpunit-4.8.phar -else - PHPUNIT_PHAR=phpunit-5.7.phar -fi -wget "https://phar.phpunit.de/${PHPUNIT_PHAR}" --output-document="${HOME}/bin/phpunit" -chmod u+x "${HOME}/bin/phpunit" - -# Coveralls client install -wget https://github.com/satooshi/php-coveralls/releases/download/v1.0.1/coveralls.phar --output-document="${HOME}/bin/coveralls" -chmod u+x "${HOME}/bin/coveralls" - -# To be removed when these issues are resolved: -# https://github.com/composer/composer/issues/5355 -# https://github.com/composer/composer/issues/5030 -composer update --prefer-dist --no-interaction --prefer-stable --quiet --ignore-platform-reqs - -composer update --prefer-dist --no-interaction --prefer-stable ${COMPOSER_FLAGS} diff --git a/project/CONTRIBUTING.md b/project/CONTRIBUTING.md index cc2bb9548..0e4efaba5 100644 --- a/project/CONTRIBUTING.md +++ b/project/CONTRIBUTING.md @@ -1,432 +1,12 @@ -# Sonata project contribution - -Thanks for your interest in Sonata projects! - -This document is about issues and pull requests. - -## Summary - -* [Issues](#issues) -* [Pull Requests](#pull-requests) -* [Code Reviews](#code-reviews) - -## Issues - -First, check if you are up to date: is your version still supported, and are -you using the latest patch version? - -GitHub Issues is for **issues**, as opposed to question on how to use Sonata. -If you are not sure this is a bug, or simply want to ask such a question, -please post your question on [Stack Overflow](http://stackoverflow.com/questions/tagged/sonata), -using the `sonata` tags. - -If you happen to find a bug, we kindly request you report it. However, -before submitting it, please check the [project documentation available -online](https://sonata-project.org/bundles/). - -Then, if it appears that it is indeed a real bug, you may report it using -Github by following these points are taken care of: - -* Check if the bug is not already reported! -* The title sums up the issue with clarity. -* A description of the workflow needed to reproduce the bug. Please try to make - sentences, dumping an error message by itself is frowned upon. -* If your issue is an error page, you must provide us with a stack trace. With - recent versions of Symfony, you can even get stack traces as plain text at the -end of the page. Just look for "Stack Trace (Plain Text)", and copy/paste what -you see. **Do not** make a screenshot of the stack trace, as screenshots are -not indexed by search engines and will make it difficult for other people to -find your bug report. If you have an issue when using the Symfony CLI, -use the `-vvv` option to get a stack trace. -* Screenshots should be considered additional data, and therefore, you should - always provide a textual description of the bug. It is strongly recommended -to provide them when reporting UI-related bugs. -* If you need to provide code, make sure you know how to get syntactic - coloration, in particular with [fenced code -blocks](https://help.github.com/articles/creating-and-highlighting-code-blocks/). -When you feel the code is to long, use external code pastebin like -https://gist.github.com/ or http://hastebin.com/ . If this is not sufficient, -just create a repository to show the issue. - -> _NOTE:_ Don't hesitate to give as much information as you can (OS, PHP -> version, extensions...) - -## Pull Requests - -All the sonata team will be glad to review your code changes propositions! :smile: - -But please, read the following before. - -### The content - -#### Coding style - -Each project follows [PSR-1](http://www.php-fig.org/psr/psr-1/), [PSR-2](http://www.php-fig.org/psr/psr-2/) -and [Symfony Coding Standards](http://symfony.com/doc/current/contributing/code/standards.html) for coding style, -[PSR-4](http://www.php-fig.org/psr/psr-4/) for autoloading. - -Please [install PHP Coding Standard Fixer](http://cs.sensiolabs.org/#installation) -and run this command before committing your modifications: - -```bash -php-cs-fixer fix --verbose -``` - -#### The documentation - -The documentation is mostly written with the `rst` format, and can be found in the `Resources/doc` directory. -You can test the doc rendering with the `make docs` command, but to do this, you will need [Sphinx][sphinx_install]. -Just like php dependencies can be managed with Composer, python dependencies can be managed with [pip][pip_install]. -To get sphinx, simply run the following command. - -```bash -pip install --requirement {{ docs_path }}/requirements.txt --user -``` - -Some python binaries should be downloaded to `~/.local/bin` for Linux or `~/Library/Python/2.7/bin` for Mac OS, -[modify your `$PATH` environment variable](http://www.linfo.org/path_env_var.html) -so that it contains this path and then, from the root of the project, run `make docs` - -If `make docs` is successful, you should be able to see your modifications: - -```bash -$YOUR_FAVORITE_BROWSER {{ docs_path }}/_build/html/index.html -``` - -If your PR contains a new feature, you must add documentation for it. -Of course, you can also create PRs consisting only in documentation changes. - -Documentation contributions should comply with [the Symfony documentation standards][sf_docs_standards]. - -#### The tests - -If your PR contains a fix, tests should be added to prove the bug. - -If your PR contains an addition, a new feature, this one has to be fully covered by tests. - -Some rules have to be respected about the test: - -* Annotations about coverage are prohibited. This concerns: - * `@covers` - * `@coversDefaultClass` - * `@coversNothing` - * `@codeCoverageIgnore` - * `@codeCoverageIgnoreStart` - * `@codeCoverageIgnoreEnd` -* All test methods should be prefixed by `test`. Example: `public function testItReturnsNull()`. -* All test method names must be in camel case format. -* As opposed, the `@test` annotation is prohibited. -* Most of the time, the test class should have the same name as the targeted class, suffixed by `Test`. -* The `@expectedException*` annotations are prohibited. Use `PHPUnit_Framework_TestCase::setExpectedException()`. - -##### Using test doubles - -Since version 4.5, PHPUnit requires and [integrates](https://phpunit.de/manual/current/en/test-doubles.html#test-doubles.prophecy) -the [phpspec/prophecy](https://github.com/phpspec/prophecy). -Historically, Sonata has been using [the built-in test doubles implementation](https://phpunit.de/manual/current/en/test-doubles.html), -but [has decided to move to Prophecy](https://github.com/sonata-project/dev-kit/issues/89), -which is more concise than its built-in counterpart is most cases. -This means the current Sonata codebase currently uses both implementations. -If you want to contribute a test that uses test doubles, please follow these rules : - -1. All new test classes MUST use Prophecy. -2. If you are changing an existing test method, you MUST use the same implementation it already uses, -and focus on the goal of your PR and only on that. -3. If you are changing an existing test class, you MUST use the same implementation it already uses, -to be more consistent. -4. You MAY submit a PR that migrates a test class from the built-in test double implementation to Prophecy, -but it must migrate it entirely. The PR should only be about the migration. - -### Writing a Pull Request - -#### The subject - -Ideally, a Pull Request should concern one and **only one** subject, so that it -remains clear, and independent changes can be merged quickly. - -If you want to fix a typo and improve the performance of a process, you should -try as much as possible to do it in a **separate** PR, so that we can quickly -merge one while discussing the other. - -The goal is to have a clear commit history and make a possible revert easier. - -If you found an issue/typo while writing your change that is not related to -your work, please do another PR for that. In some rare cases, you might be -forced to do it on the same PR. In this kind of situation, please add a comment -on your PR explaining why you feel it is the case. - -#### The Change log - -For each PR, a change log must be provided. - -There are few cases where no change log is necessary: - -* When you fix a bug on an unreleased feature. -* When your PR concerns only the documentation (fix or improvement). - -**Do not** edit the `CHANGELOG.md` directly though, because having every -contributor write PR with changes in the same file, at roughly the same line is -a recipe for conflicts. Instead, fill in the dedicated section that should -appear in a textaread when submitting your PR. - -Your note can be put on one of these sections: - -* `Added` for new features. -* `Changed` for changes in existing functionality. -* `Deprecated` for deprecation of features that will be removed in next major release. -* `Removed` for deprecated features removed in this release. -* `Fixed` for any bug fixes. -* `Security` to invite users to upgrade in case of vulnerabilities. - -More information about the followed changelog format: [keepachangelog.com](http://keepachangelog.com/) - -#### The base branch - -Before writing a PR, you have to check on which branch your changes should be based. - -Each project follows [semver](http://semver.org/) convention for release management. - -Here is a short table resuming on which you have to start: - -Kind of modification | Backward Compatible (BC) | Type of release | Branch to target | Label | --------------------- | ------------------------ | --------------- | ----------------------- | ----- | -Bug fixes | Yes | Patch | `{{ legacy_branch }}` | | -Bug fixes | Not on legacy | Patch | `{{ stable_branch }}` | | -Bug fixes | No (Only if no choice) | Major | `{{ unstable_branch }}` | | -Feature | Yes | Minor | `{{ stable_branch }}` | | -Feature | No (Only if no choice) | Major | `{{ unstable_branch }}` | | -Deprecation | Yes (Have to) | Minor | `{{ stable_branch }}` | | -Deprecation removal | No (Can't be) | Major | `{{ unstable_branch }}` | | - -Notes: - * Branch `{{ legacy_branch }}` is the branch of the **latest stable** patch releases and - has to be used for Backward Compatible bug fixes only. - * Branch `{{ stable_branch }}` is the branch of the **latest stable** minor release and - has to be used for Backward compatible enhancement PRs. - **No bug fix will be accepted here**, except if the bug fix concerns `{{ stable_branch }}` and **only this one**. - Bug fixes merged on `{{ legacy_branch }}` will be ported on other branches by fallback merging. - * If you PR is not **Backward Compatible** but can be, it **must** be: - * Changing a function/method signature? Prefer create a new one and deprecate the old one. - * Code deletion? Don't. Please deprecate it instead. - * If your BC PR is accepted, you can do a new one on the `{{ unstable_branch }}` branch which removes the deprecated code. - * SYMFONY DOC REF (same logic)? - -If you have a non-BC PR to propose, please try to create a related BC PR first. -This BC PR should mark every piece of code that needs to be removed / uncommented / reworked -in the corresponding non-BC PR with the following marker comment : `NEXT_MAJOR`. -When the BC PR is merged in the stable branch, wait for the stable branch to be -merged in the unstable branch, and then work on your non-BC PR. - -For instance, assuming you want to introduce a new method to an existing interface, you should do something like this: - -```php -normalizeKeys(false) ->prototype('array') ->children() - ->arrayNode('excluded_files')->prototype('scalar')->defaultValue(array())->end()->end() + ->arrayNode('excluded_files')->prototype('scalar')->defaultValue([])->end()->end() ->booleanNode('docs_target')->defaultTrue()->end() + ->scalarNode('description')->defaultValue('')->end() ->arrayNode('branches') ->normalizeKeys(false) - ->defaultValue(array()) + ->defaultValue([]) ->prototype('array') ->children() - ->arrayNode('php')->prototype('scalar')->defaultValue(array())->end()->end() - ->arrayNode('services')->prototype('scalar')->defaultValue(array())->end()->end() + ->arrayNode('php')->prototype('scalar')->defaultValue([])->end()->end() + ->arrayNode('services')->prototype('scalar')->defaultValue([])->end()->end() ->scalarNode('target_php')->defaultNull()->end() ->append($this->addVersionsNode()) ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() @@ -80,7 +81,7 @@ private function addVersionsNode() $childrenNode = $node->children(); foreach ($this->devKitConfigs['packages'] as $key => $name) { - $childrenNode->arrayNode($key)->prototype('scalar')->defaultValue(array())->end()->end(); + $childrenNode->arrayNode($key)->prototype('scalar')->defaultValue([])->end()->end(); } $childrenNode->end(); diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index bbb14694c..5226e7446 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -28,10 +28,11 @@ */ abstract class AbstractCommand extends Command { - const GITHUB_GROUP = 'sonata-project'; - const GITHUB_USER = 'SonataCI'; - const GITHUB_EMAIL = 'thomas+ci@sonata-project.org'; - const PACKAGIST_GROUP = 'sonata-project'; + const GITHUB_GROUP = 'symfony-cmf'; + const GITHUB_USER = 'electricmaxxx'; + const GITHUB_EMAIL = 'maximilian.berghoff@gmx.de'; + const PACKAGIST_GROUP = 'symfony-cmf'; + const HOMEPAGE = 'http://cmf.symfony.com/'; /** * @var SymfonyStyle @@ -77,10 +78,10 @@ protected function initialize(InputInterface $input, OutputInterface $output) $processor = new Processor(); $devKitConfigs = $processor->processConfiguration(new DevKitConfiguration(), array( - 'sonata' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/dev-kit.yml')), + 'cmf' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/dev-kit.yml')), )); $projectsConfigs = $processor->processConfiguration(new ProjectsConfiguration($devKitConfigs), array( - 'sonata' => array('projects' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/projects.yml'))), + 'cmf' => array('projects' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/projects.yml'))), )); $this->configs = array_merge($devKitConfigs, $projectsConfigs); diff --git a/src/Console/Command/DependsCommand.php b/src/Console/Command/DependsCommand.php index 4f29708c8..44f1ad849 100644 --- a/src/Console/Command/DependsCommand.php +++ b/src/Console/Command/DependsCommand.php @@ -27,7 +27,7 @@ protected function configure() { $this ->setName('depends') - ->setDescription('Show internal sonata dependencies of each project.') + ->setDescription('Show internal symfony-cmf dependencies of each project.') ->addOption('branch-depth', null, InputOption::VALUE_OPTIONAL, 'Number of branches to show.', 2) ; } diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index 22ca7a3dc..af1b7e3c8 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -1,14 +1,5 @@ - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - namespace Sonata\DevKit\Console\Command; use Doctrine\Common\Inflector\Inflector; @@ -58,9 +49,8 @@ protected function configure() $this ->setName('dispatch') ->setDescription('Dispatches configuration and documentation files for all sonata projects.') - ->addArgument('projects', InputArgument::IS_ARRAY, 'To limit the dispatcher on given project(s).', array()) - ->addOption('with-files', null, InputOption::VALUE_NONE, 'Applies Pull Request actions for projects files') - ; + ->addArgument('projects', InputArgument::IS_ARRAY, 'To limit the dispatcher on given project(s).', []) + ->addOption('with-files', null, InputOption::VALUE_NONE, 'Applies Pull Request actions for projects files'); } protected function initialize(InputInterface $input, OutputInterface $output) @@ -69,12 +59,11 @@ protected function initialize(InputInterface $input, OutputInterface $output) $this->gitWrapper = new GitWrapper(); $this->fileSystem = new Filesystem(); - $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(__DIR__.'/../../..')); + $this->twig = new \Twig_Environment(new \Twig_Loader_Filesystem(__DIR__ . '/../../..')); $this->projects = count($input->getArgument('projects')) ? $input->getArgument('projects') - : array_keys($this->configs['projects']) - ; + : array_keys($this->configs['projects']); } /** @@ -91,11 +80,11 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($this->projects as $name) { try { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP.'/'.$name); + $package = $this->packagistClient->get(static::PACKAGIST_GROUP . '/' . $name); $projectConfig = $this->configs['projects'][$name]; $this->io->title($package->getName()); $this->updateRepositories($package, $projectConfig); - $this->updateDevKitHook($package); + // $this->updateDevKitHook($package); $this->updateLabels($package); $this->updateBranchesProtection($package, $projectConfig); @@ -103,7 +92,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $this->dispatchFiles($package); } } catch (ExceptionInterface $e) { - $this->io->error('Failed with message: '.$e->getMessage()); + $this->io->error('Failed with message: ' . $e->getMessage()); } } @@ -114,25 +103,23 @@ protected function execute(InputInterface $input, OutputInterface $output) * Sets repository information and general settings. * * @param Package $package - * @param array $projectConfig */ - private function updateRepositories(Package $package, array $projectConfig) + private function updateRepositories(Package $package) { $repositoryName = $this->getRepositoryName($package); - $branches = array_keys($projectConfig['branches']); $this->io->section('Repository'); $repositoryInfo = $this->githubClient->repo()->show(static::GITHUB_GROUP, $repositoryName); - $infoToUpdate = array( - 'homepage' => 'https://sonata-project.org/', + $infoToUpdate = [ + 'homepage' => self::HOMEPAGE, 'has_issues' => true, 'has_projects' => true, 'has_wiki' => false, - 'default_branch' => end($branches), + 'default_branch' => 'master', 'allow_squash_merge' => true, 'allow_merge_commit' => false, 'allow_rebase_merge' => true, - ); + ]; foreach ($infoToUpdate as $info => $value) { if ($value === $repositoryInfo[$info]) { @@ -143,9 +130,11 @@ private function updateRepositories(Package $package, array $projectConfig) if (count($infoToUpdate)) { $this->io->comment('Following info have to be changed: '.implode(', ', array_keys($infoToUpdate)).'.'); if ($this->apply) { - $this->githubClient->repo()->update(static::GITHUB_GROUP, $repositoryName, array_merge($infoToUpdate, array( - 'name' => $repositoryName, - ))); + $this->githubClient->repo()->update( + static::GITHUB_GROUP, + $repositoryName, + array_merge($infoToUpdate, ['name' => $repositoryName]) + ); } } elseif (!count($infoToUpdate)) { $this->io->comment(static::LABEL_NOTHING_CHANGED); @@ -163,8 +152,8 @@ private function updateLabels(Package $package) $configuredLabels = $this->configs['labels']; $missingLabels = $configuredLabels; - $headers = array('Name', 'Actual color', 'Needed Color', 'State'); - $rows = array(); + $headers = ['Name', 'Actual color', 'Needed Color', 'State']; + $rows = []; foreach ($this->githubClient->repo()->labels()->all(static::GITHUB_GROUP, $repositoryName) as $label) { $name = $label['name']; @@ -197,8 +186,8 @@ private function updateLabels(Package $package) if ($state) { array_push($rows, array( $name, - '#'.$color, - $configuredColor ? '#'.$configuredColor : 'N/A', + '#' . $color, + $configuredColor ? '#' . $configuredColor : 'N/A', $state, )); } @@ -213,7 +202,7 @@ private function updateLabels(Package $package) 'color' => $color, )); } - array_push($rows, array($name, 'N/A', '#'.$color, 'Created')); + array_push($rows, array($name, 'N/A', '#' . $color, 'Created')); } usort($rows, function ($row1, $row2) { @@ -239,7 +228,7 @@ private function updateDevKitHook(Package $package) // Construct the hook url. $hookToken = getenv('DEK_KIT_TOKEN') ? getenv('DEK_KIT_TOKEN') : 'INVALID_TOKEN'; $hookBaseUrl = 'http://sonata-dev-kit.sullivansenechal.com/github'; - $hookCompleteUrl = $hookBaseUrl.'?'.http_build_query(array('token' => $hookToken)); + $hookCompleteUrl = $hookBaseUrl . '?' . http_build_query(array('token' => $hookToken)); // Set hook configs $config = array( @@ -299,7 +288,7 @@ private function updateDevKitHook(Package $package) /** * @param Package $package - * @param array $projectConfig + * @param array $projectConfig */ private function updateBranchesProtection(Package $package, array $projectConfig) { @@ -332,8 +321,7 @@ private function updateBranchesProtection(Package $package, array $projectConfig ); foreach ($branches as $branch) { $this->githubClient->repo()->protection() - ->update(static::GITHUB_GROUP, $repositoryName, $branch, $protectionConfig) - ; + ->update(static::GITHUB_GROUP, $repositoryName, $branch, $protectionConfig); } $this->io->comment('Branches protection applied.'); } @@ -344,7 +332,7 @@ private function updateBranchesProtection(Package $package, array $projectConfig private function dispatchFiles(Package $package) { $repositoryName = $this->getRepositoryName($package); - $projectConfig = $this->configs['projects'][str_replace(static::PACKAGIST_GROUP.'/', '', $package->getName())]; + $projectConfig = $this->configs['projects'][str_replace(static::PACKAGIST_GROUP . '/', '', $package->getName())]; // No branch to manage, continue to next project. if (0 === count($projectConfig['branches'])) { @@ -352,19 +340,19 @@ private function dispatchFiles(Package $package) } // Clone the repository. - $clonePath = sys_get_temp_dir().'/sonata-project/'.$repositoryName; + $baseDirectory = sys_get_temp_dir() . '/dev-kit'; + if (!is_dir($baseDirectory)) { + mkdir($baseDirectory); + } + $clonePath = $baseDirectory . '/' . $repositoryName; if ($this->fileSystem->exists($clonePath)) { $this->fileSystem->remove($clonePath); } $git = $this->gitWrapper->cloneRepository( - 'https://'.static::GITHUB_USER.':'.$this->githubAuthKey.'@github.com/'.static::GITHUB_GROUP.'/'.$repositoryName, + 'https://' . static::GITHUB_USER . ':' . $this->githubAuthKey . '@github.com/' . static::GITHUB_GROUP . '/' . $repositoryName, $clonePath ); - $git - ->config('user.name', static::GITHUB_USER) - ->config('user.email', static::GITHUB_EMAIL) - ; - + $git->config('user.name', static::GITHUB_USER) ->config('user.email', static::GITHUB_EMAIL); $branches = array_reverse($projectConfig['branches']); $previousBranch = null; @@ -376,7 +364,7 @@ private function dispatchFiles(Package $package) }, $this->githubClient->repos()->branches(static::GITHUB_GROUP, $repositoryName)); $currentBranch = key($branches); - $currentDevKit = $currentBranch.'-dev-kit'; + $currentDevKit = $currentBranch . '-dev-kit'; next($branches); // A PR is already here for previous branch, do nothing on the current one. @@ -385,13 +373,16 @@ private function dispatchFiles(Package $package) } // If the previous branch is not merged into the current one, do nothing. if ($previousBranch && $this->githubClient->repos()->commits()->compare( - static::GITHUB_GROUP, $repositoryName, $currentBranch, $previousBranch - )['ahead_by']) { + static::GITHUB_GROUP, + $repositoryName, + $currentBranch, + $previousBranch + )['ahead_by']) { continue; } // Diff application - $this->io->section('Files for '.$currentBranch); + $this->io->section('Files for ' . $currentBranch); $git->reset(array('hard' => true)); @@ -399,11 +390,11 @@ private function dispatchFiles(Package $package) if (in_array($currentBranch, $git->getBranches()->all(), true)) { $git->checkout($currentBranch); } else { - $git->checkout('-b', $currentBranch, '--track', 'origin/'.$currentBranch); + $git->checkout('-b', $currentBranch, '--track', 'origin/' . $currentBranch); } // Checkout the dev-kit branch - if (in_array('remotes/origin/'.$currentDevKit, $git->getBranches()->all(), true)) { - $git->checkout('-b', $currentDevKit, '--track', 'origin/'.$currentDevKit); + if (in_array('remotes/origin/' . $currentDevKit, $git->getBranches()->all(), true)) { + $git->checkout('-b', $currentDevKit, '--track', 'origin/' . $currentDevKit); } else { $git->checkout('-b', $currentDevKit); } @@ -421,12 +412,12 @@ private function dispatchFiles(Package $package) // If the Pull Request does not exists yet, create it. $pulls = $this->githubClient->pullRequests()->all(static::GITHUB_GROUP, $repositoryName, array( 'state' => 'open', - 'head' => 'sonata-project:'.$currentDevKit, + 'head' => 'dev-kit:' . $currentDevKit, )); if (0 === count($pulls)) { $this->githubClient->pullRequests()->create(static::GITHUB_GROUP, $repositoryName, array( - 'title' => 'DevKit updates for '.$currentBranch.' branch', - 'head' => 'sonata-project:'.$currentDevKit, + 'title' => 'DevKit updates for ' . $currentBranch . ' branch', + 'head' => 'dev-kit:' . $currentDevKit, 'base' => $currentBranch, 'body' => '', )); @@ -447,20 +438,26 @@ private function dispatchFiles(Package $package) /** * @param Package $package - * @param string $repositoryName - * @param string $localPath - * @param string $distPath - * @param array $projectConfig - * @param string $branchName + * @param string $repositoryName + * @param string $localPath + * @param string $distPath + * @param array $projectConfig + * @param string $branchName */ - private function renderFile(Package $package, $repositoryName, $localPath, $distPath, array $projectConfig, $branchName) - { - $localFullPath = __DIR__.'/../../../'.$localPath; + private function renderFile( + Package $package, + $repositoryName, + $localPath, + $distPath, + array $projectConfig, + $branchName + ) { + $localFullPath = __DIR__ . '/../../../' . $localPath; $localFileType = filetype($localFullPath); $distFileType = $this->fileSystem->exists($distPath) ? filetype($distPath) : false; if ($localFileType !== $distFileType && false !== $distFileType) { - throw new \LogicException('File type mismatch between "'.$localPath.'" and "'.$distPath.'"'); + throw new \LogicException('File type mismatch between "' . $localPath . '" and "' . $distPath . '"'); } if (in_array(substr($localPath, 8), $projectConfig['excluded_files'], true)) { @@ -474,8 +471,8 @@ private function renderFile(Package $package, $repositoryName, $localPath, $dist $this->renderFile( $package, $repositoryName, - $localPath.'/'.$entry, - $distPath.'/'.$entry, + $localPath . '/' . $entry, + $distPath . '/' . $entry, $projectConfig, $branchName ); @@ -494,19 +491,19 @@ private function renderFile(Package $package, $repositoryName, $localPath, $dist $branchConfig = $projectConfig['branches'][$branchName]; $localPathInfo = pathinfo($localPath); if (array_key_exists('extension', $localPathInfo) && 'twig' === $localPathInfo['extension']) { - $distPath = dirname($distPath).'/'.basename($distPath, '.twig'); + $distPath = dirname($distPath) . '/' . basename($distPath, '.twig'); file_put_contents($distPath, $this->twig->render($localPath, array_merge( $this->configs, $projectConfig, $branchConfig, - array('repository_name' => $repositoryName) + ['repository_name' => $repositoryName] ))); } else { reset($projectConfig['branches']); $unstableBranch = key($projectConfig['branches']); $stableBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $unstableBranch; $legacyBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $stableBranch; - file_put_contents($distPath, str_replace(array( + file_put_contents($distPath, str_replace([ '{{ package_title }}', '{{ package_description }}', '{{ packagist_name }}', @@ -517,8 +514,8 @@ private function renderFile(Package $package, $repositoryName, $localPath, $dist '{{ legacy_branch }}', '{{ docs_path }}', '{{ website_path }}', - ), array( - Inflector::ucwords(str_replace(array('-project', '/', '-'), array('', ' ', ' '), $package->getName())), + ], [ + Inflector::ucwords(str_replace(['-project', '/', '-'], ['', ' ', ' '], $package->getName())), $package->getDescription(), $package->getName(), $repositoryName, @@ -527,8 +524,8 @@ private function renderFile(Package $package, $repositoryName, $localPath, $dist $stableBranch, $legacyBranch, $branchConfig['docs_path'], - str_replace(array(static::PACKAGIST_GROUP.'/', '-bundle'), '', $package->getName()), - ), $localContent)); + str_replace([static::PACKAGIST_GROUP . '/', '-bundle'], '', $package->getName()), + ], $localContent)); } // Restore file permissions after content copy $this->fileSystem->chmod($distPath, fileperms($localPath)); From a937c2339ef5a0ed7a1c77c28c366dd6134f1b81 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 12 Oct 2017 16:23:43 +0200 Subject: [PATCH 02/39] use twig for README and pass a parameter to licence file also --- config/projects.yml | 2 ++ project/.github/ISSUE_TEMPLATE.md | 8 +++++++- project/{README.md => README.md.twig} | 6 ++++-- project/src/Resources/meta/LICENSE | 2 +- src/Console/Command/DependsCommand.php | 4 ++-- src/Console/Command/DispatchCommand.php | 22 ++++++++++++++++------ 6 files changed, 32 insertions(+), 12 deletions(-) rename project/{README.md => README.md.twig} (97%) diff --git a/config/projects.yml b/config/projects.yml index 6f976a58f..9e0090dc1 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -7,10 +7,12 @@ seo-bundle: aware for Search Engine Optimisation (SEO)." branches: master: + docs_path: 'bundles/seo' php: ['5.6', '7.0', '7.1'] versions: symfony: ['2.8', '3.1', '3.2', '3.3'] "2.0": + docs_path: 'bundles/seo' php: ['5.6', '7.0', '7.1'] versions: symfony: ['2.8', '3.1', '3.2', '3.3'] diff --git a/project/.github/ISSUE_TEMPLATE.md b/project/.github/ISSUE_TEMPLATE.md index 2b835bc94..6e681006e 100644 --- a/project/.github/ISSUE_TEMPLATE.md +++ b/project/.github/ISSUE_TEMPLATE.md @@ -10,7 +10,13 @@ ### Environment -#### Symfony packages +#### Symfony paackages + +``` +$ composer show --latest 'symfony/*' +``` + +#### Symfony CMF packages ``` $ composer show --latest 'symfony-cmf/*' diff --git a/project/README.md b/project/README.md.twig similarity index 97% rename from project/README.md rename to project/README.md.twig index 92b0c53d8..fcf0379b8 100644 --- a/project/README.md +++ b/project/README.md.twig @@ -10,7 +10,9 @@ Branch | Travis | Coveralls | ------ | ------ | --------- | +{% if legacy_branch != stable_branch %} {{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_legacy_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | +{% endif %} {{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | {{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | @@ -26,7 +28,7 @@ Branch | Travis | Coveralls | For the install guide and reference, see: -* [{{ packagist_name }} Documentation](http://symfony.com/doc/master/cmf/bundles/{{ website_path }}/index.html) +* [{{ packagist_name }} Documentation](http://symfony.com/doc/master/cmf/{{ docs_path }}/index.html) See also: @@ -47,7 +49,7 @@ Unit and/or functional tests exist for this bundle. See the [Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) for a guide to running the tests. -Thanks to +Thanks to [everyone who has contributed](contributors) already. ## License diff --git a/project/src/Resources/meta/LICENSE b/project/src/Resources/meta/LICENSE index d3fc81e8b..c73993079 100644 --- a/project/src/Resources/meta/LICENSE +++ b/project/src/Resources/meta/LICENSE @@ -1,4 +1,4 @@ -SeoBundle +{{ package_title }} The MIT License diff --git a/src/Console/Command/DependsCommand.php b/src/Console/Command/DependsCommand.php index 44f1ad849..21188974a 100644 --- a/src/Console/Command/DependsCommand.php +++ b/src/Console/Command/DependsCommand.php @@ -27,7 +27,7 @@ protected function configure() { $this ->setName('depends') - ->setDescription('Show internal symfony-cmf dependencies of each project.') + ->setDescription('Show internal symfony-cmf or symfony dependencies of each project.') ->addOption('branch-depth', null, InputOption::VALUE_OPTIONAL, 'Number of branches to show.', 2) ; } @@ -54,7 +54,7 @@ protected function execute(InputInterface $input, OutputInterface $output) continue; } foreach ($version->getRequire() as $packageName => $constraint) { - if (!strstr($packageName, 'sonata-project/')) { + if (!strstr($packageName, 'symfony-cmf/') && !strstr($packageName, 'symfony/')) { continue; } $this->io->writeln($packageName.':'.$constraint); diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index af1b7e3c8..2ffb3be1b 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -490,19 +490,29 @@ private function renderFile( $branchConfig = $projectConfig['branches'][$branchName]; $localPathInfo = pathinfo($localPath); + reset($projectConfig['branches']); + $unstableBranch = key($projectConfig['branches']); + $stableBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $unstableBranch; + $legacyBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $stableBranch; if (array_key_exists('extension', $localPathInfo) && 'twig' === $localPathInfo['extension']) { $distPath = dirname($distPath) . '/' . basename($distPath, '.twig'); file_put_contents($distPath, $this->twig->render($localPath, array_merge( $this->configs, $projectConfig, $branchConfig, - ['repository_name' => $repositoryName] + [ + 'package_title' => Inflector::ucwords(str_replace(['cmf', '/', '-'], ['CMF', ' ', ' '], $package->getName())), + 'package_description' => $package->getDescription(), + 'packagist_name' => $package->getName(), + 'package_name' => $package->getName(), + 'repository_name' => $repositoryName, + 'current_branch' => $branchName, + 'unstable_branch' => $unstableBranch, + 'stable_branch' => $stableBranch, + 'legacy_branch' => $legacyBranch, + ] ))); } else { - reset($projectConfig['branches']); - $unstableBranch = key($projectConfig['branches']); - $stableBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $unstableBranch; - $legacyBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $stableBranch; file_put_contents($distPath, str_replace([ '{{ package_title }}', '{{ package_description }}', @@ -515,7 +525,7 @@ private function renderFile( '{{ docs_path }}', '{{ website_path }}', ], [ - Inflector::ucwords(str_replace(['-project', '/', '-'], ['', ' ', ' '], $package->getName())), + Inflector::ucwords(str_replace(['/', '-'], [' ', ' '], $package->getName())), $package->getDescription(), $package->getName(), $repositoryName, From d51dbbb294d8ff549e2742fd5d0526a7901666d9 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 15 Oct 2017 14:36:57 +0200 Subject: [PATCH 03/39] make Makefile tasks conditional depending on project configuration --- config/projects.yml | 10 ++++++++++ project/{Makefile => Makefile.twig} | 21 ++++++++++++++++----- src/Config/ProjectsConfiguration.php | 4 ++++ 3 files changed, 30 insertions(+), 5 deletions(-) rename project/{Makefile => Makefile.twig} (64%) diff --git a/config/projects.yml b/config/projects.yml index 9e0090dc1..f5bfe1e5d 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -9,10 +9,20 @@ seo-bundle: master: docs_path: 'bundles/seo' php: ['5.6', '7.0', '7.1'] + make_tasks: + test_unit: ~ + test_integration_phpcr: ~ + test_integration_orm: ~ + test_installation: ~ versions: symfony: ['2.8', '3.1', '3.2', '3.3'] "2.0": docs_path: 'bundles/seo' php: ['5.6', '7.0', '7.1'] + make_tasks: + test_unit: ~ + test_integration_phpcr: ~ + test_integration_orm: ~ + test_installation: ~ versions: symfony: ['2.8', '3.1', '3.2', '3.3'] diff --git a/project/Makefile b/project/Makefile.twig similarity index 64% rename from project/Makefile rename to project/Makefile.twig index 0020ae151..0475a8257 100644 --- a/project/Makefile +++ b/project/Makefile.twig @@ -22,21 +22,32 @@ PACKAGE=symfony-cmf/seo-bundle list: @echo 'test: will run all tests' - @echo 'test_unit: will run unit tests only' - @echo 'test_integration_phpcr: will run integration tests on PHPCR' - @echo 'test_integration_orm: will run integration tests on ORM' +{% if make_tasks.test_unit is defined %} @echo 'test_unit: will run unit tests only'{% endif %} +{% if make_tasks.test_integration_phpcr is defined %} @echo 'test_integration_phpcr: will run integration tests on PHPCR'{% endif %} + +{% if make_tasks.test_integration_orm is defined %} @echo 'test_integration_orm: will run integration tests on ORM'{% endif %} + + +{% if make_tasks.test_integration_phpcr is defined %} test_integration_phpcr: ./${TESTING_SCRIPTS_DIR}/make/test.sh -c${CONSOLE} -tintegration_phpcr +{% endif %} +{% if make_tasks.test_integration_orm is defined %} test_integration_orm: ./${TESTING_SCRIPTS_DIR}/make/test.sh -c${CONSOLE} -tintegration_orm +{% endif %} - +{% if make_tasks.test_unit is defined %} test_unit: ./${TESTING_SCRIPTS_DIR}/make/test.sh -tunit +{% endif %} +{% if make_tasks.test_installation is defined %} test_installation: ./${TESTING_SCRIPTS_DIR}/make/test.sh -p${PACKAGE} -v${VERSION} -ttest_installation +{% endif %} + +test:{% for test, value in make_tasks if test != 'test_installation' %} {{ test }}{% endfor %} -test: test_unit test_integration_phpcr test_integration_orm diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 0b75bd0cf..82c5c9d48 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -61,6 +61,10 @@ public function getConfigTreeBuilder() ->scalarNode('target_php')->defaultNull()->end() ->append($this->addVersionsNode()) ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() + ->arrayNode('make_tasks') + ->prototype('scalar') + ->defaultValue([]) + ->end() ->end() ->end() ->end() From abab0fc37b33d47bdc0290f51c7cdab3701605ba Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 15 Oct 2017 15:14:09 +0200 Subject: [PATCH 04/39] use procect configuration versions in readme file --- project/README.md.twig | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/project/README.md.twig b/project/README.md.twig index fcf0379b8..3cbfa9187 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -20,8 +20,10 @@ Branch | Travis | Coveralls | ## Requirements -* PHP 5.6 / 7 -* Symfony 2.8 / 3 +* PHP {% for version in php %}{{ version }}{% if version != php|last %} / {% endif %}{% endfor %} + +* Symfony {% for version in versions.symfony %}{{ version }}{% if version != versions.symfony|last %} / {% endif %}{% endfor %} + * See also the `require` section of [composer.json](composer.json) ## Documentation From 454aa37d7f648880f580b6f5a5ec648bcb1a8939 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 15 Oct 2017 20:38:43 +0200 Subject: [PATCH 05/39] some code style changes --- project/.styleci.yml | 8 +- project/.travis.yml.twig | 8 +- project/Makefile.twig | 8 +- src/Console/Command/AbstractCommand.php | 10 +-- src/Console/Command/AutoMergeCommand.php | 6 +- src/Console/Command/DispatchCommand.php | 76 +++++++++---------- src/Console/Command/MergeConflictsCommand.php | 12 +-- .../Command/PullRequestAutoMergeCommand.php | 8 +- src/GithubHookProcessor.php | 4 +- web/index.php | 12 +-- 10 files changed, 79 insertions(+), 73 deletions(-) diff --git a/project/.styleci.yml b/project/.styleci.yml index 6d1247d86..105adfe5a 100644 --- a/project/.styleci.yml +++ b/project/.styleci.yml @@ -1,6 +1,8 @@ -# DO NOT EDIT THIS FILE! -# -# It's auto-generated by symfony-cmf/dev-kit package. +####################################################### +# DO NOT EDIT THIS FILE! # +# # +# It's auto-generated by symfony-cmf/dev-kit package. # +####################################################### ############################################################################ # This file is part of the Symfony CMF package. # diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index ea2713bcc..491c0f8c3 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -1,6 +1,8 @@ -# DO NOT EDIT THIS FILE! -# -# It's auto-generated by symfony-cmf/dev-kit package. +####################################################### +# DO NOT EDIT THIS FILE! # +# # +# It's auto-generated by symfony-cmf/dev-kit package. # +####################################################### ############################################################################ # This file is part of the Symfony CMF package. # diff --git a/project/Makefile.twig b/project/Makefile.twig index 0475a8257..b14acb4d1 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -1,6 +1,8 @@ -# DO NOT EDIT THIS FILE! -# -# It's auto-generated by symfony-cmf/dev-kit package. +####################################################### +# DO NOT EDIT THIS FILE! # +# # +# It's auto-generated by symfony-cmf/dev-kit package. # +####################################################### ############################################################################ # This file is part of the Symfony CMF package. # diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 5226e7446..9e88ce230 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -77,12 +77,12 @@ protected function initialize(InputInterface $input, OutputInterface $output) $this->io = new SymfonyStyle($input, $output); $processor = new Processor(); - $devKitConfigs = $processor->processConfiguration(new DevKitConfiguration(), array( + $devKitConfigs = $processor->processConfiguration(new DevKitConfiguration(), [ 'cmf' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/dev-kit.yml')), - )); - $projectsConfigs = $processor->processConfiguration(new ProjectsConfiguration($devKitConfigs), array( - 'cmf' => array('projects' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/projects.yml'))), - )); + ]); + $projectsConfigs = $processor->processConfiguration(new ProjectsConfiguration($devKitConfigs), [ + 'cmf' => ['projects' => Yaml::parse(file_get_contents(__DIR__.'/../../../config/projects.yml'))], + ]); $this->configs = array_merge($devKitConfigs, $projectsConfigs); if (getenv('GITHUB_OAUTH_TOKEN')) { diff --git a/src/Console/Command/AutoMergeCommand.php b/src/Console/Command/AutoMergeCommand.php index 4941f807c..63fe2ea58 100644 --- a/src/Console/Command/AutoMergeCommand.php +++ b/src/Console/Command/AutoMergeCommand.php @@ -38,7 +38,7 @@ protected function configure() $this ->setName('auto-merge') ->setDescription('Merges branches of repositories if there is no conflict.') - ->addArgument('projects', InputArgument::IS_ARRAY, 'To limit the dispatcher on given project(s).', array()) + ->addArgument('projects', InputArgument::IS_ARRAY, 'To limit the dispatcher on given project(s).', []) ; } @@ -119,10 +119,10 @@ private function mergeBranches(Package $package, array $projectConfig) $message = sprintf('Merging of %s into %s contains conflicts. Skipped.', $head, $base); $this->io->warning($message); - $this->slackClient->attach(array( + $this->slackClient->attach([ 'text' => $message, 'color' => 'danger', - ))->send('Merging: '.$repositoryName); + ])->send('Merging: '.$repositoryName); continue; } diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index 2ffb3be1b..5d3ad072e 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -83,7 +83,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $package = $this->packagistClient->get(static::PACKAGIST_GROUP . '/' . $name); $projectConfig = $this->configs['projects'][$name]; $this->io->title($package->getName()); - $this->updateRepositories($package, $projectConfig); + $this->updateRepositories($package); // $this->updateDevKitHook($package); $this->updateLabels($package); $this->updateBranchesProtection($package, $projectConfig); @@ -176,20 +176,20 @@ private function updateLabels(Package $package) } elseif ($shouldBeUpdated) { $state = 'Updated'; if ($this->apply) { - $this->githubClient->repo()->labels()->update(static::GITHUB_GROUP, $repositoryName, $name, array( + $this->githubClient->repo()->labels()->update(static::GITHUB_GROUP, $repositoryName, $name, [ 'name' => $name, 'color' => $configuredColor, - )); + ]); } } if ($state) { - array_push($rows, array( + array_push($rows, [ $name, '#' . $color, $configuredColor ? '#' . $configuredColor : 'N/A', $state, - )); + ]); } } @@ -197,12 +197,12 @@ private function updateLabels(Package $package) $color = $label['color']; if ($this->apply) { - $this->githubClient->repo()->labels()->create(static::GITHUB_GROUP, $repositoryName, array( + $this->githubClient->repo()->labels()->create(static::GITHUB_GROUP, $repositoryName, [ 'name' => $name, 'color' => $color, - )); + ]); } - array_push($rows, array($name, 'N/A', '#' . $color, 'Created')); + array_push($rows, [$name, 'N/A', '#' . $color, 'Created']); } usort($rows, function ($row1, $row2) { @@ -228,19 +228,19 @@ private function updateDevKitHook(Package $package) // Construct the hook url. $hookToken = getenv('DEK_KIT_TOKEN') ? getenv('DEK_KIT_TOKEN') : 'INVALID_TOKEN'; $hookBaseUrl = 'http://sonata-dev-kit.sullivansenechal.com/github'; - $hookCompleteUrl = $hookBaseUrl . '?' . http_build_query(array('token' => $hookToken)); + $hookCompleteUrl = $hookBaseUrl . '?' . http_build_query(['token' => $hookToken]); // Set hook configs - $config = array( + $config = [ 'url' => $hookCompleteUrl, 'insecure_ssl' => '0', 'content_type' => 'json', - ); - $events = array( + ]; + $events = [ 'issue_comment', 'pull_request', 'pull_request_review_comment', - ); + ]; // First, check if the hook exists. $devKitHook = null; @@ -257,12 +257,12 @@ private function updateDevKitHook(Package $package) $this->io->comment('Has to be created.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->create(static::GITHUB_GROUP, $repositoryName, array( + $this->githubClient->repo()->hooks()->create(static::GITHUB_GROUP, $repositoryName, [ 'name' => 'web', 'config' => $config, 'events' => $events, 'active' => true, - )); + ]); $this->io->success('Hook created.'); } } elseif (count(array_diff_assoc($devKitHook['config'], $config)) @@ -272,12 +272,12 @@ private function updateDevKitHook(Package $package) $this->io->comment('Has to be updated.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->update(static::GITHUB_GROUP, $repositoryName, $devKitHook['id'], array( + $this->githubClient->repo()->hooks()->update(static::GITHUB_GROUP, $repositoryName, $devKitHook['id'], [ 'name' => 'web', 'config' => $config, 'events' => $events, 'active' => true, - )); + ]); $this->githubClient->repo()->hooks()->ping(static::GITHUB_GROUP, $repositoryName, $devKitHook['id']); $this->io->success('Hook updated.'); } @@ -300,25 +300,25 @@ private function updateBranchesProtection(Package $package, array $projectConfig return; } - $protectionConfig = array( - 'required_status_checks' => array( + $protectionConfig = [ + 'required_status_checks' => [ 'strict' => false, - 'contexts' => array( + 'contexts' => [ 'continuous-integration/travis-ci', 'continuous-integration/styleci/pr', - ), - ), - 'required_pull_request_reviews' => array( - 'dismissal_restrictions' => array( - 'users' => array(), - 'teams' => array(), - ), + ], + ], + 'required_pull_request_reviews' => [ + 'dismissal_restrictions' => [ + 'users' => [], + 'teams' => [], + ], 'dismiss_stale_reviews' => true, 'require_code_owner_reviews' => true, - ), + ], 'restrictions' => null, 'enforce_admins' => false, - ); + ]; foreach ($branches as $branch) { $this->githubClient->repo()->protection() ->update(static::GITHUB_GROUP, $repositoryName, $branch, $protectionConfig); @@ -384,7 +384,7 @@ private function dispatchFiles(Package $package) // Diff application $this->io->section('Files for ' . $currentBranch); - $git->reset(array('hard' => true)); + $git->reset(['hard' => true]); // Checkout the targeted branch if (in_array($currentBranch, $git->getBranches()->all(), true)) { @@ -401,7 +401,7 @@ private function dispatchFiles(Package $package) $this->renderFile($package, $repositoryName, 'project', $clonePath, $projectConfig, $currentBranch); - $git->add('.', array('all' => true))->getOutput(); + $git->add('.', ['all' => true])->getOutput(); $diff = $git->diff('--color', '--cached')->getOutput(); if (!empty($diff)) { @@ -410,17 +410,17 @@ private function dispatchFiles(Package $package) $git->commit('DevKit updates')->push('-u', 'origin', $currentDevKit); // If the Pull Request does not exists yet, create it. - $pulls = $this->githubClient->pullRequests()->all(static::GITHUB_GROUP, $repositoryName, array( + $pulls = $this->githubClient->pullRequests()->all(static::GITHUB_GROUP, $repositoryName, [ 'state' => 'open', - 'head' => 'dev-kit:' . $currentDevKit, - )); + 'head' => $currentDevKit, + ]); if (0 === count($pulls)) { - $this->githubClient->pullRequests()->create(static::GITHUB_GROUP, $repositoryName, array( + $this->githubClient->pullRequests()->create(static::GITHUB_GROUP, $repositoryName, [ 'title' => 'DevKit updates for ' . $currentBranch . ' branch', - 'head' => 'dev-kit:' . $currentDevKit, + 'head' => $currentDevKit, 'base' => $currentBranch, 'body' => '', - )); + ]); } // Wait 200ms to be sure GitHub API is up to date with new pushed branch/PR. @@ -467,7 +467,7 @@ private function renderFile( if ('dir' === $localFileType) { $localDirectory = dir($localFullPath); while (false !== ($entry = $localDirectory->read())) { - if (!in_array($entry, array('.', '..'), true)) { + if (!in_array($entry, ['.', '..'], true)) { $this->renderFile( $package, $repositoryName, diff --git a/src/Console/Command/MergeConflictsCommand.php b/src/Console/Command/MergeConflictsCommand.php index 86c6e328f..d02e0924b 100644 --- a/src/Console/Command/MergeConflictsCommand.php +++ b/src/Console/Command/MergeConflictsCommand.php @@ -65,11 +65,11 @@ private function checkPullRequests(Package $package) // @see: https://developer.github.com/v3/pulls/#get-a-single-pull-request if (false === $pullRequest['mergeable']) { $comments = array_filter( - $this->githubPaginator->fetchAll($this->githubClient->issues()->comments(), 'all', array( + $this->githubPaginator->fetchAll($this->githubClient->issues()->comments(), 'all', [ static::GITHUB_GROUP, $repositoryName, $number, - )), + ]), function ($comment) { return static::GITHUB_USER === $comment['user']['login']; } @@ -77,19 +77,19 @@ function ($comment) { $lastComment = end($comments); $lastCommentDate = $lastComment ? new \DateTime($lastComment['created_at']) : null; - $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequest(), 'commits', array( + $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequest(), 'commits', [ static::GITHUB_GROUP, $repositoryName, $number, - )); + ]); $lastCommit = end($commits); $lastCommitDate = new \DateTime($lastCommit['commit']['committer']['date']); if (!$lastCommentDate || $lastCommentDate < $lastCommitDate) { if ($this->apply) { - $this->githubClient->issues()->comments()->create(static::GITHUB_GROUP, $repositoryName, $number, array( + $this->githubClient->issues()->comments()->create(static::GITHUB_GROUP, $repositoryName, $number, [ 'body' => 'Could you please rebase your PR and fix merge conflicts?', - )); + ]); $this->githubClient->addIssueLabel(static::GITHUB_GROUP, $repositoryName, $number, 'pending author'); } diff --git a/src/Console/Command/PullRequestAutoMergeCommand.php b/src/Console/Command/PullRequestAutoMergeCommand.php index 0229b7161..776d02d65 100644 --- a/src/Console/Command/PullRequestAutoMergeCommand.php +++ b/src/Console/Command/PullRequestAutoMergeCommand.php @@ -58,10 +58,10 @@ private function mergePullRequest(Package $package, array $projectConfig) $repositoryName = $this->getRepositoryName($package); $branches = array_keys($projectConfig['branches']); - $pulls = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'all', array( + $pulls = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'all', [ static::GITHUB_GROUP, $repositoryName, - )); + ]); foreach ($pulls as $pull) { // Do not managed not configured branches. if (!in_array(str_replace('-dev-kit', '', $pull['base']['ref']), $branches, true)) { @@ -95,11 +95,11 @@ private function mergePullRequest(Package $package, array $projectConfig) continue; } - $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'commits', array( + $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'commits', [ static::GITHUB_GROUP, $repositoryName, $pull['number'], - )); + ]); $commitMessages = array_map(function ($commit) { return $commit['commit']['message']; diff --git a/src/GithubHookProcessor.php b/src/GithubHookProcessor.php index 382f05458..7b31e17f0 100644 --- a/src/GithubHookProcessor.php +++ b/src/GithubHookProcessor.php @@ -43,7 +43,7 @@ public function __construct($githubAuthKey = null) */ public function processPendingAuthor($eventName, array $payload) { - if (!in_array($payload['action'], array('created', 'synchronize'), true)) { + if (!in_array($payload['action'], ['created', 'synchronize'], true)) { return; } @@ -70,7 +70,7 @@ public function processPendingAuthor($eventName, array $payload) */ public function processReviewLabels($eventName, array $payload) { - if (!in_array($payload['action'], array('opened', 'synchronize'), true)) { + if (!in_array($payload['action'], ['opened', 'synchronize'], true)) { return; } diff --git a/web/index.php b/web/index.php index 43ce48422..0803ca6a1 100644 --- a/web/index.php +++ b/web/index.php @@ -23,17 +23,17 @@ $app = new Silex\Application(); $app - ->register(new TwigServiceProvider(), array( + ->register(new TwigServiceProvider(), [ 'twig.path' => __DIR__.'/../views', - )) + ]) ; $app->get('/', function () use ($app) { $revision = file_exists(__DIR__.'/../REVISION') ? trim(file_get_contents(__DIR__.'/../REVISION')) : null; - return $app['twig']->render('index.html.twig', array( + return $app['twig']->render('index.html.twig', [ 'revision' => $revision, - )); + ]); }); $app->post('/github', function (Request $request) use ($app, $githubHookProcessor, $devKitToken) { @@ -41,7 +41,7 @@ $payload = json_decode($request->getContent(), true); if (!$devKitToken || $request->query->get('token') !== $devKitToken) { - return $app->json(array('message' => 'Invalid credentials'), 403); + return $app->json(['message' => 'Invalid credentials'], 403); } switch ($eventName) { @@ -61,7 +61,7 @@ return new Response(); default: - return new JsonResponse(array('message' => 'Nothing to do for: '.$eventName), 200); + return new JsonResponse(['message' => 'Nothing to do for: '.$eventName], 200); } }); From 9906ec68e14461ba1621b46973b6302465de6300 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 17 Oct 2017 21:53:48 +0200 Subject: [PATCH 06/39] current state --- config/projects.yml | 10 ---------- project/.styleci.yml | 10 +++++++++- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index f5bfe1e5d..27e621265 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -16,13 +16,3 @@ seo-bundle: test_installation: ~ versions: symfony: ['2.8', '3.1', '3.2', '3.3'] - "2.0": - docs_path: 'bundles/seo' - php: ['5.6', '7.0', '7.1'] - make_tasks: - test_unit: ~ - test_integration_phpcr: ~ - test_integration_orm: ~ - test_installation: ~ - versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] diff --git a/project/.styleci.yml b/project/.styleci.yml index 105adfe5a..7e04682c9 100644 --- a/project/.styleci.yml +++ b/project/.styleci.yml @@ -17,7 +17,15 @@ preset: symfony enabled: - - ordered_use + - combine_consecutive_unsets - short_array_syntax + - newline_after_open_tag + - no_php4_constructor + - no_useless_else + - ordered_use +# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results + - strict + - php_unit_construct + - php_unit_strict disabled: [single_line_class_definition] From 3bd720eda4d801da9d86153e831ba1975026d75d Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 18 Oct 2017 22:08:43 +0200 Subject: [PATCH 07/39] move parameters to env file --- .env.dist | 6 +++ config/projects.yml | 6 +-- project/Makefile.twig | 36 +++++----------- src/Console/Command/AbstractCommand.php | 19 +++++---- src/Console/Command/AutoMergeCommand.php | 4 +- src/Console/Command/DependsCommand.php | 2 +- src/Console/Command/DispatchCommand.php | 42 +++++++++---------- src/Console/Command/MergeConflictsCommand.php | 16 +++---- .../Command/PullRequestAutoMergeCommand.php | 12 +++--- 9 files changed, 68 insertions(+), 75 deletions(-) diff --git a/.env.dist b/.env.dist index 8cc743743..c75214fd4 100644 --- a/.env.dist +++ b/.env.dist @@ -4,3 +4,9 @@ SLACK_HOOK=hook_to_be_changed DEPLOY_SERVER=server_name_for_deploy DEPLOY_USER=ssh_login_for_deploy + +GITHUB_GROUP=github_organistion +GITHUB_USER=github_user +GITHUB_EMAIL=mail_of_github_user +PACKAGIST_GROUP=packagist_group +HOMEPAGE=homepage diff --git a/config/projects.yml b/config/projects.yml index 27e621265..1b7340725 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -10,9 +10,9 @@ seo-bundle: docs_path: 'bundles/seo' php: ['5.6', '7.0', '7.1'] make_tasks: - test_unit: ~ - test_integration_phpcr: ~ - test_integration_orm: ~ + unit_tests: ~ + functional_tests_phpcr: ~ + functional_tests_orm: ~ test_installation: ~ versions: symfony: ['2.8', '3.1', '3.2', '3.3'] diff --git a/project/Makefile.twig b/project/Makefile.twig index b14acb4d1..27f851cfa 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -15,41 +15,25 @@ TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin CONSOLE=${TESTING_SCRIPTS_DIR}/console -ifneq (${BRANCH},"") +VERSION=dev-master +ifdef BRANCH VERSION=dev-${BRANCH} -else - VERSION=dev-master endif -PACKAGE=symfony-cmf/seo-bundle +PACKAGE={{ repository_name }} list: @echo 'test: will run all tests' -{% if make_tasks.test_unit is defined %} @echo 'test_unit: will run unit tests only'{% endif %} +{% if make_tasks.unit_tests is defined %} @echo 'unit_tests: will run unit tests only'{% endif %} -{% if make_tasks.test_integration_phpcr is defined %} @echo 'test_integration_phpcr: will run integration tests on PHPCR'{% endif %} +{% if make_tasks.functional_tests_phpcr is defined %} @echo 'functional_tests_phpcr: will run functional tests with PHPCR'{% endif %} -{% if make_tasks.test_integration_orm is defined %} @echo 'test_integration_orm: will run integration tests on ORM'{% endif %} +{% if make_tasks.functional_tests_orm is defined %} @echo 'functional_tests_orm: will run functional tests with ORM'{% endif %} +{% if make_tasks.test_installation is defined %} @echo 'test_installation: will run installation test'{% endif %} -{% if make_tasks.test_integration_phpcr is defined %} -test_integration_phpcr: - ./${TESTING_SCRIPTS_DIR}/make/test.sh -c${CONSOLE} -tintegration_phpcr -{% endif %} - -{% if make_tasks.test_integration_orm is defined %} -test_integration_orm: - ./${TESTING_SCRIPTS_DIR}/make/test.sh -c${CONSOLE} -tintegration_orm -{% endif %} - -{% if make_tasks.test_unit is defined %} -test_unit: - ./${TESTING_SCRIPTS_DIR}/make/test.sh -tunit -{% endif %} - -{% if make_tasks.test_installation is defined %} -test_installation: - ./${TESTING_SCRIPTS_DIR}/make/test.sh -p${PACKAGE} -v${VERSION} -ttest_installation -{% endif %} +{% for test, value in make_tasks %} +include ${TESTING_SCRIPTS_DIR}/make/{{ test }}.mk +{% endfor %} test:{% for test, value in make_tasks if test != 'test_installation' %} {{ test }}{% endfor %} diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index 9e88ce230..ae22e49e3 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -28,11 +28,11 @@ */ abstract class AbstractCommand extends Command { - const GITHUB_GROUP = 'symfony-cmf'; - const GITHUB_USER = 'electricmaxxx'; - const GITHUB_EMAIL = 'maximilian.berghoff@gmx.de'; - const PACKAGIST_GROUP = 'symfony-cmf'; - const HOMEPAGE = 'http://cmf.symfony.com/'; + protected $githubGroup; + protected $githubUser; + protected $githubEmail; + protected $packagistGroup; + protected $homepage; /** * @var SymfonyStyle @@ -85,9 +85,12 @@ protected function initialize(InputInterface $input, OutputInterface $output) ]); $this->configs = array_merge($devKitConfigs, $projectsConfigs); - if (getenv('GITHUB_OAUTH_TOKEN')) { - $this->githubAuthKey = getenv('GITHUB_OAUTH_TOKEN'); - } + $this->githubAuthKey = getenv('GITHUB_OAUTH_TOKEN'); + $this->githubGroup = getenv('GITHUB_GROUP'); + $this->githubUser = getenv('GITHUB_USER'); + $this->githubEmail = getenv('GITHUB_EMAIL'); + $this->packagistGroup = getenv('PACKAGIST_GROUP'); + $this->homepage = getenv('HOMEPAGE'); $this->packagistClient = new \Packagist\Api\Client(); diff --git a/src/Console/Command/AutoMergeCommand.php b/src/Console/Command/AutoMergeCommand.php index 63fe2ea58..1283b096d 100644 --- a/src/Console/Command/AutoMergeCommand.php +++ b/src/Console/Command/AutoMergeCommand.php @@ -71,7 +71,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $projectConfig = $this->configs['projects'][$name]; try { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP.'/'.$name); + $package = $this->packagistClient->get($this->packagistGroup.'/'.$name); $this->io->title($package->getName()); $this->mergeBranches($package, $projectConfig); } catch (ExceptionInterface $e) { @@ -102,7 +102,7 @@ private function mergeBranches(Package $package, array $projectConfig) // Merge message should be removed when following PR will be merged and tagged. // https://github.com/KnpLabs/php-github-api/pull/379 $response = $this->githubClient->repo()->merge( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $base, $head, diff --git a/src/Console/Command/DependsCommand.php b/src/Console/Command/DependsCommand.php index 21188974a..39590f72b 100644 --- a/src/Console/Command/DependsCommand.php +++ b/src/Console/Command/DependsCommand.php @@ -40,7 +40,7 @@ protected function execute(InputInterface $input, OutputInterface $output) $branchDepth = intval($input->getOption('branch-depth')); foreach ($this->configs['projects'] as $name => $config) { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP.'/'.$name); + $package = $this->packagistClient->get($this->packagistGroup.'/'.$name); $this->io->title($package->getName()); $bd = 0; diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index 5d3ad072e..815ece10b 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -80,7 +80,7 @@ protected function execute(InputInterface $input, OutputInterface $output) foreach ($this->projects as $name) { try { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP . '/' . $name); + $package = $this->packagistClient->get($this->packagistGroup . '/' . $name); $projectConfig = $this->configs['projects'][$name]; $this->io->title($package->getName()); $this->updateRepositories($package); @@ -109,9 +109,9 @@ private function updateRepositories(Package $package) $repositoryName = $this->getRepositoryName($package); $this->io->section('Repository'); - $repositoryInfo = $this->githubClient->repo()->show(static::GITHUB_GROUP, $repositoryName); + $repositoryInfo = $this->githubClient->repo()->show($this->githubGroup, $repositoryName); $infoToUpdate = [ - 'homepage' => self::HOMEPAGE, + 'homepage' => $this->homepage, 'has_issues' => true, 'has_projects' => true, 'has_wiki' => false, @@ -131,7 +131,7 @@ private function updateRepositories(Package $package) $this->io->comment('Following info have to be changed: '.implode(', ', array_keys($infoToUpdate)).'.'); if ($this->apply) { $this->githubClient->repo()->update( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, array_merge($infoToUpdate, ['name' => $repositoryName]) ); @@ -155,7 +155,7 @@ private function updateLabels(Package $package) $headers = ['Name', 'Actual color', 'Needed Color', 'State']; $rows = []; - foreach ($this->githubClient->repo()->labels()->all(static::GITHUB_GROUP, $repositoryName) as $label) { + foreach ($this->githubClient->repo()->labels()->all($this->githubGroup, $repositoryName) as $label) { $name = $label['name']; $color = $label['color']; @@ -171,12 +171,12 @@ private function updateLabels(Package $package) if (!$shouldExist) { $state = 'Deleted'; if ($this->apply) { - $this->githubClient->repo()->labels()->remove(static::GITHUB_GROUP, $repositoryName, $name); + $this->githubClient->repo()->labels()->remove($this->githubGroup, $repositoryName, $name); } } elseif ($shouldBeUpdated) { $state = 'Updated'; if ($this->apply) { - $this->githubClient->repo()->labels()->update(static::GITHUB_GROUP, $repositoryName, $name, [ + $this->githubClient->repo()->labels()->update($this->githubGroup, $repositoryName, $name, [ 'name' => $name, 'color' => $configuredColor, ]); @@ -197,7 +197,7 @@ private function updateLabels(Package $package) $color = $label['color']; if ($this->apply) { - $this->githubClient->repo()->labels()->create(static::GITHUB_GROUP, $repositoryName, [ + $this->githubClient->repo()->labels()->create($this->githubGroup, $repositoryName, [ 'name' => $name, 'color' => $color, ]); @@ -244,7 +244,7 @@ private function updateDevKitHook(Package $package) // First, check if the hook exists. $devKitHook = null; - foreach ($this->githubClient->repo()->hooks()->all(static::GITHUB_GROUP, $repositoryName) as $hook) { + foreach ($this->githubClient->repo()->hooks()->all($this->githubGroup, $repositoryName) as $hook) { if (array_key_exists('url', $hook['config']) && 0 === strncmp($hook['config']['url'], $hookBaseUrl, strlen($hookBaseUrl))) { $devKitHook = $hook; @@ -257,7 +257,7 @@ private function updateDevKitHook(Package $package) $this->io->comment('Has to be created.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->create(static::GITHUB_GROUP, $repositoryName, [ + $this->githubClient->repo()->hooks()->create($this->githubGroup, $repositoryName, [ 'name' => 'web', 'config' => $config, 'events' => $events, @@ -272,13 +272,13 @@ private function updateDevKitHook(Package $package) $this->io->comment('Has to be updated.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->update(static::GITHUB_GROUP, $repositoryName, $devKitHook['id'], [ + $this->githubClient->repo()->hooks()->update($this->githubGroup, $repositoryName, $devKitHook['id'], [ 'name' => 'web', 'config' => $config, 'events' => $events, 'active' => true, ]); - $this->githubClient->repo()->hooks()->ping(static::GITHUB_GROUP, $repositoryName, $devKitHook['id']); + $this->githubClient->repo()->hooks()->ping($this->githubGroup, $repositoryName, $devKitHook['id']); $this->io->success('Hook updated.'); } } else { @@ -321,7 +321,7 @@ private function updateBranchesProtection(Package $package, array $projectConfig ]; foreach ($branches as $branch) { $this->githubClient->repo()->protection() - ->update(static::GITHUB_GROUP, $repositoryName, $branch, $protectionConfig); + ->update($this->githubGroup, $repositoryName, $branch, $protectionConfig); } $this->io->comment('Branches protection applied.'); } @@ -332,7 +332,7 @@ private function updateBranchesProtection(Package $package, array $projectConfig private function dispatchFiles(Package $package) { $repositoryName = $this->getRepositoryName($package); - $projectConfig = $this->configs['projects'][str_replace(static::PACKAGIST_GROUP . '/', '', $package->getName())]; + $projectConfig = $this->configs['projects'][str_replace($this->packagistGroup . '/', '', $package->getName())]; // No branch to manage, continue to next project. if (0 === count($projectConfig['branches'])) { @@ -349,10 +349,10 @@ private function dispatchFiles(Package $package) $this->fileSystem->remove($clonePath); } $git = $this->gitWrapper->cloneRepository( - 'https://' . static::GITHUB_USER . ':' . $this->githubAuthKey . '@github.com/' . static::GITHUB_GROUP . '/' . $repositoryName, + 'https://' . $this->githubUser . ':' . $this->githubAuthKey . '@github.com/' . $this->githubGroup . '/' . $repositoryName, $clonePath ); - $git->config('user.name', static::GITHUB_USER) ->config('user.email', static::GITHUB_EMAIL); + $git->config('user.name', $this->githubUser) ->config('user.email', $this->githubEmail); $branches = array_reverse($projectConfig['branches']); $previousBranch = null; @@ -361,7 +361,7 @@ private function dispatchFiles(Package $package) // We have to fetch all branches on each step in case a PR is submitted. $remoteBranches = array_map(function ($branch) { return $branch['name']; - }, $this->githubClient->repos()->branches(static::GITHUB_GROUP, $repositoryName)); + }, $this->githubClient->repos()->branches($this->githubGroup, $repositoryName)); $currentBranch = key($branches); $currentDevKit = $currentBranch . '-dev-kit'; @@ -373,7 +373,7 @@ private function dispatchFiles(Package $package) } // If the previous branch is not merged into the current one, do nothing. if ($previousBranch && $this->githubClient->repos()->commits()->compare( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $currentBranch, $previousBranch @@ -410,12 +410,12 @@ private function dispatchFiles(Package $package) $git->commit('DevKit updates')->push('-u', 'origin', $currentDevKit); // If the Pull Request does not exists yet, create it. - $pulls = $this->githubClient->pullRequests()->all(static::GITHUB_GROUP, $repositoryName, [ + $pulls = $this->githubClient->pullRequests()->all($this->githubGroup, $repositoryName, [ 'state' => 'open', 'head' => $currentDevKit, ]); if (0 === count($pulls)) { - $this->githubClient->pullRequests()->create(static::GITHUB_GROUP, $repositoryName, [ + $this->githubClient->pullRequests()->create($this->githubGroup, $repositoryName, [ 'title' => 'DevKit updates for ' . $currentBranch . ' branch', 'head' => $currentDevKit, 'base' => $currentBranch, @@ -534,7 +534,7 @@ private function renderFile( $stableBranch, $legacyBranch, $branchConfig['docs_path'], - str_replace([static::PACKAGIST_GROUP . '/', '-bundle'], '', $package->getName()), + str_replace([$this->packagistGroup . '/', '-bundle'], '', $package->getName()), ], $localContent)); } // Restore file permissions after content copy diff --git a/src/Console/Command/MergeConflictsCommand.php b/src/Console/Command/MergeConflictsCommand.php index d02e0924b..6c899fde8 100644 --- a/src/Console/Command/MergeConflictsCommand.php +++ b/src/Console/Command/MergeConflictsCommand.php @@ -41,7 +41,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { foreach ($this->configs['projects'] as $name => $projectConfig) { try { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP.'/'.$name); + $package = $this->packagistClient->get($this->packagistGroup.'/'.$name); $this->io->title($package->getName()); $this->checkPullRequests($package); } catch (ExceptionInterface $e) { @@ -56,9 +56,9 @@ private function checkPullRequests(Package $package) { $repositoryName = $this->getRepositoryName($package); - foreach ($this->githubClient->pullRequests()->all(static::GITHUB_GROUP, $repositoryName) as $pullRequest) { + foreach ($this->githubClient->pullRequests()->all($this->githubGroup, $repositoryName) as $pullRequest) { $number = $pullRequest['number']; - $pullRequest = $this->githubClient->pullRequests()->show(static::GITHUB_GROUP, $repositoryName, $number); + $pullRequest = $this->githubClient->pullRequests()->show($this->githubGroup, $repositoryName, $number); // The value of the mergeable attribute can be true, false, or null. // If the value is null this means that the mergeability hasn't been computed yet. @@ -66,19 +66,19 @@ private function checkPullRequests(Package $package) if (false === $pullRequest['mergeable']) { $comments = array_filter( $this->githubPaginator->fetchAll($this->githubClient->issues()->comments(), 'all', [ - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $number, ]), function ($comment) { - return static::GITHUB_USER === $comment['user']['login']; + return $this->githubUser === $comment['user']['login']; } ); $lastComment = end($comments); $lastCommentDate = $lastComment ? new \DateTime($lastComment['created_at']) : null; $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequest(), 'commits', [ - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $number, ]); @@ -87,10 +87,10 @@ function ($comment) { if (!$lastCommentDate || $lastCommentDate < $lastCommitDate) { if ($this->apply) { - $this->githubClient->issues()->comments()->create(static::GITHUB_GROUP, $repositoryName, $number, [ + $this->githubClient->issues()->comments()->create($this->githubGroup, $repositoryName, $number, [ 'body' => 'Could you please rebase your PR and fix merge conflicts?', ]); - $this->githubClient->addIssueLabel(static::GITHUB_GROUP, $repositoryName, $number, 'pending author'); + $this->githubClient->addIssueLabel($this->githubGroup, $repositoryName, $number, 'pending author'); } $this->io->text(sprintf('#%d - %s', $pullRequest['number'], $pullRequest['title'])); diff --git a/src/Console/Command/PullRequestAutoMergeCommand.php b/src/Console/Command/PullRequestAutoMergeCommand.php index 776d02d65..0ebf353d6 100644 --- a/src/Console/Command/PullRequestAutoMergeCommand.php +++ b/src/Console/Command/PullRequestAutoMergeCommand.php @@ -38,7 +38,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { foreach ($this->configs['projects'] as $name => $projectConfig) { try { - $package = $this->packagistClient->get(static::PACKAGIST_GROUP.'/'.$name); + $package = $this->packagistClient->get($this->packagistGroup.'/'.$name); $this->io->title($package->getName()); $this->mergePullRequest($package, $projectConfig); } catch (ExceptionInterface $e) { @@ -59,7 +59,7 @@ private function mergePullRequest(Package $package, array $projectConfig) $branches = array_keys($projectConfig['branches']); $pulls = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'all', [ - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, ]); foreach ($pulls as $pull) { @@ -81,7 +81,7 @@ private function mergePullRequest(Package $package, array $projectConfig) )); $state = $this->githubClient->repos()->statuses()->combined( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $pull['head']['sha'] ); @@ -96,7 +96,7 @@ private function mergePullRequest(Package $package, array $projectConfig) } $commits = $this->githubPaginator->fetchAll($this->githubClient->pullRequests(), 'commits', [ - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $pull['number'], ]); @@ -120,7 +120,7 @@ private function mergePullRequest(Package $package, array $projectConfig) if ($this->apply) { try { $this->githubClient->pullRequests()->merge( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, $pull['number'], $squash ? '' : $pull['title'], @@ -131,7 +131,7 @@ private function mergePullRequest(Package $package, array $projectConfig) if ('sonata-project' === $pull['head']['repo']['owner']['login']) { $this->githubClient->gitData()->references()->remove( - static::GITHUB_GROUP, + $this->githubGroup, $repositoryName, 'heads/'.$pull['head']['ref'] ); From b80bc080b3d44eb4c523245956590c3851f9dccd Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 19 Oct 2017 08:47:18 +0200 Subject: [PATCH 08/39] increase php version for seo, fix travis creation for less then 2 configured php version --- config/projects.yml | 4 ++-- project/.github/ISSUE_TEMPLATE.md | 2 +- project/.styleci.yml | 1 - project/.travis.yml.twig | 8 ++++++++ 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 1b7340725..b8ed327f2 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -8,11 +8,11 @@ seo-bundle: branches: master: docs_path: 'bundles/seo' - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8', '3.1', '3.2', '3.3', '3.4', '4.0'] diff --git a/project/.github/ISSUE_TEMPLATE.md b/project/.github/ISSUE_TEMPLATE.md index 6e681006e..25da2b37e 100644 --- a/project/.github/ISSUE_TEMPLATE.md +++ b/project/.github/ISSUE_TEMPLATE.md @@ -10,7 +10,7 @@ ### Environment -#### Symfony paackages +#### Symfony packages ``` $ composer show --latest 'symfony/*' diff --git a/project/.styleci.yml b/project/.styleci.yml index 7e04682c9..69322d0ae 100644 --- a/project/.styleci.yml +++ b/project/.styleci.yml @@ -23,7 +23,6 @@ enabled: - no_php4_constructor - no_useless_else - ordered_use -# Comment strict rules for the moment. Should be uncomment later to see StyleCI PR results - strict - php_unit_construct - php_unit_strict diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 491c0f8c3..bf6e71243 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -37,12 +37,20 @@ matrix: env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* - php: {{ php|first }} env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }}.* SYMFONY_DEPRECATIONS_HELPER=weak +{% if php|length < 3 %} +{% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} + - php: {{ php|last }} + env: SYMFONY={{ version }}.* +{% endfor %} +{% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} env: SYMFONY={{ version }}.* {% endfor %} {% endfor %} +{% endif %} + - env: TEST_INSTALLATION=true fast_finish: true From 7b9fb5af75fc94acdb1c8ebd99d654797ee57e43 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 20 Oct 2017 06:51:24 +0200 Subject: [PATCH 09/39] use latest symfony as allowed failures --- project/.travis.yml.twig | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index bf6e71243..c84e01987 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -53,6 +53,10 @@ matrix: - env: TEST_INSTALLATION=true fast_finish: true + allowed_failures: + - php: {{ php|last }} + env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* + before_install: - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi From 6bb0c15ec04c1aee5939415ab494af41fbc730a4 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 20 Oct 2017 10:38:21 +0200 Subject: [PATCH 10/39] use allow_failure on travis --- config/projects.yml | 4 +++- project/.travis.yml.twig | 16 ++++++++++------ src/Config/ProjectsConfiguration.php | 17 +++++++++++++++++ 3 files changed, 30 insertions(+), 7 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index b8ed327f2..93d84c9c5 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -15,4 +15,6 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3', '3.4', '4.0'] + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index c84e01987..368da5606 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -16,7 +16,7 @@ language: php php: - - 7.0 + - 7.1 sudo: false @@ -26,13 +26,16 @@ cache: - $HOME/.composer/cache/files env: - matrix: SYMFONY_VERSION=3.2.* + matrix: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} global: - SYMFONY_DEPRECATIONS_HELPER=48 - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" SYMFONY_PHPUNIT_VERSION=5.7 + - TEST_INSTALLATION=false matrix: include: + - php: {{ php|last }} + env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* - php: {{ php|last }} env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* - php: {{ php|first }} @@ -40,22 +43,23 @@ matrix: {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: SYMFONY={{ version }}.* + env: SYMFONY_VERSION={{ version }}.* {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: SYMFONY={{ version }}.* + env: SYMFONY_VERSION={{ version }}.* {% endfor %} {% endfor %} {% endif %} - env: TEST_INSTALLATION=true fast_finish: true - allowed_failures: + allow_failures: - php: {{ php|last }} - env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* + env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* + - env: TEST_INSTALLATION=true before_install: diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 82c5c9d48..aedb0b080 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -60,6 +60,7 @@ public function getConfigTreeBuilder() ->arrayNode('services')->prototype('scalar')->defaultValue([])->end()->end() ->scalarNode('target_php')->defaultNull()->end() ->append($this->addVersionsNode()) + ->append($this->addFailingVersionsNode()) ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() ->arrayNode('make_tasks') ->prototype('scalar') @@ -92,4 +93,20 @@ private function addVersionsNode() return $node; } + + private function addFailingVersionsNode() + { + $builder = new TreeBuilder(); + $node = $builder->root('failing_allowed_versions'); + + $childrenNode = $node->children(); + + foreach ($this->devKitConfigs['packages'] as $key => $name) { + $childrenNode->arrayNode($key)->prototype('scalar')->defaultValue([])->end()->end(); + } + + $childrenNode->end(); + + return $node; + } } From f367a7c909a8bd6fd46d6e36c7e8be8ec88a287b Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 20 Oct 2017 12:58:48 +0200 Subject: [PATCH 11/39] add core-bundle and fix readme description --- config/projects.yml | 24 +++++++++++++++++++----- project/Makefile.twig | 2 +- project/README.md.twig | 5 ++++- 3 files changed, 24 insertions(+), 7 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 93d84c9c5..883996185 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -1,10 +1,7 @@ seo-bundle: description: | - "This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) - and licensed under the [MIT License](LICENSE). - - It provides a solution to make content bundles - aware for Search Engine Optimisation (SEO)." + It provides a solution to make content bundles + aware for Search Engine Optimisation (SEO). branches: master: docs_path: 'bundles/seo' @@ -18,3 +15,20 @@ seo-bundle: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +core-bundle: + description: | + The CoreBundle for the Symfony content management framework provides common functionality, + helpers and utilities for the other CMF bundles. The major features are a publish workflow, + a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. + branches: + master: + docs_path: 'bundles/core' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] diff --git a/project/Makefile.twig b/project/Makefile.twig index 27f851cfa..b3b3bcd73 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -19,7 +19,7 @@ VERSION=dev-master ifdef BRANCH VERSION=dev-${BRANCH} endif -PACKAGE={{ repository_name }} +PACKAGE={{ packagist_name }} list: @echo 'test: will run all tests' diff --git a/project/README.md.twig b/project/README.md.twig index 3cbfa9187..645b1cf10 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -16,7 +16,10 @@ Branch | Travis | Coveralls | {{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | {{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | -{{ package_description }} +This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed +under the [MIT License](LICENSE). + +{{ description }} ## Requirements From f8e23f357a6fc3fd3ad8a7250ffd6030a143d83e Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 20 Oct 2017 13:08:38 +0200 Subject: [PATCH 12/39] revert phpunit_strict --- project/.styleci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/project/.styleci.yml b/project/.styleci.yml index 69322d0ae..2bdb04b1f 100644 --- a/project/.styleci.yml +++ b/project/.styleci.yml @@ -25,6 +25,5 @@ enabled: - ordered_use - strict - php_unit_construct - - php_unit_strict disabled: [single_line_class_definition] From 2c98e80cc4ff2acaab839d214da529f128d10291 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sat, 21 Oct 2017 06:27:11 +0200 Subject: [PATCH 13/39] use menu-bundle --- config/projects.yml | 15 +++++++++++++++ project/README.md.twig | 2 ++ 2 files changed, 17 insertions(+) diff --git a/config/projects.yml b/config/projects.yml index 883996185..27e5d92d6 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -32,3 +32,18 @@ core-bundle: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +menu-bundle: + description: | + The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. + branches: + master: + docs_path: 'bundles/menu' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] diff --git a/project/README.md.twig b/project/README.md.twig index 645b1cf10..b247c5f81 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -13,7 +13,9 @@ Branch | Travis | Coveralls | {% if legacy_branch != stable_branch %} {{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_legacy_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | {% endif %} +{% if unstable_branch != stable_branch %} {{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | +{% endif %} {{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed From e51dce7745ae179a6df5dc973d73700871d84c00 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 23 Oct 2017 08:41:03 +0200 Subject: [PATCH 14/39] add routing component --- config/projects.yml | 145 +++++++++++++++++++++++++++ project/.travis.yml.twig | 6 +- project/CONTRIBUTING.md | 4 +- project/README.md.twig | 6 +- src/Config/ProjectsConfiguration.php | 1 + 5 files changed, 154 insertions(+), 8 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 27e5d92d6..0e2f845f0 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -47,3 +47,148 @@ menu-bundle: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +routing-bundle: + description: | + The RoutingBundle enables the + [CMF Routing component](https://github.com/symfony-cmf/Routing) + as a Symfony bundle. It provides route documents for Doctrine PHPCR-ODM and a + controller for redirection routes. + branches: + master: + docs_path: 'bundles/routing' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + functional_tests_orm: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] +routing: + description: | + The Symfony CMF Routing component extends the Symfony routing component with additional features: + + * A ChainRouter to run several routers in parallel + * A DynamicRouter that can load routes from any database and can generate + additional information in the route match. + + The CMF Routing component does not need the Symfony full stack framework. It is + also useful in applications not using the full Symfony framework. + + For the best integration into the Symfony full stack framework, it is + recommended to use the [RoutingBundle](https://github.com/symfony-cmf/RoutingBundle) + when building Symfony full stack applications. + branches: + master: + docs_path: 'components/routing' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] +content-bundle: + description: | + The ContentBundle provides a document for static content and the controller to render it. + branches: + master: + docs_path: 'bundles/routing' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] +resource-rest-bundle: + description: | + This Bundle provides a REST API to Puli resources as provided by the CmfResource component. + branches: + master: + docs_path: 'bundles/resource-rest' + docs_extra: | + ## Example + + ````bash + $ curl http://localhost:8000/api/phpcrodm_repo/foo | python -m json.tool + { + "_links": { + "self": { + "href": "/api/phpcrodm_repo/foo" + } + }, + "children": { + "bar": { + "_links": { + "self": { + "href": "/api/phpcrodm_repo/foo/bar" + } + }, + "children": [], + "document": { + "_links": { + "self": { + "href": "/path/to/this" + } + }, + "body": "This is my second article", + "id": "/tests/cmf/articles/foo/bar", + "title": "Article 2" + }, + "path": "/foo/bar", + "repo_path": "/foo/bar" + }, + "boo": { + "_links": { + "self": { + "href": "/api/phpcrodm_repo/foo/boo" + } + }, + "children": [], + "document": { + "_links": { + "self": { + "href": "/path/to/this" + } + }, + "body": "This is my third article", + "id": "/tests/cmf/articles/foo/boo", + "title": "Article 2" + }, + "path": "/foo/boo", + "repo_path": "/foo/boo" + } + }, + "document": { + "_links": { + "self": { + "href": "/path/to/this" + } + }, + "body": "This is my article", + "id": "/tests/cmf/articles/foo", + "title": "Article 1" + }, + "path": "/foo", + "repo_path": "/foo" + } + ```` + ## Running the tests + + ### Behat + - Setup database: `./vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh` + - Run server: `./vendor/symfony-cmf/testing/bin/server` + - Run tests: `./vendor/bin/behat` + php: ['7.0', '7.1'] + make_tasks: + unit_tests: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 368da5606..11876e144 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -59,7 +59,9 @@ matrix: allow_failures: - php: {{ php|last }} env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* - - env: TEST_INSTALLATION=true +{% if make_tasks.test_installation is defined %} +- env: TEST_INSTALLATION=true +{% endif %} before_install: @@ -72,8 +74,6 @@ before_install: install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS -before_script: vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh - script: - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi diff --git a/project/CONTRIBUTING.md b/project/CONTRIBUTING.md index 0e4efaba5..521e2c2ce 100644 --- a/project/CONTRIBUTING.md +++ b/project/CONTRIBUTING.md @@ -1,8 +1,8 @@ Contributing ------------ -Symfony2 CMF is an open source, community-driven project. We follow the same -guidelines as core Symfony2. If you'd like to contribute, please read the +Symfony CMF is an open source, community-driven project. We follow the same +guidelines as core Symfony. If you'd like to contribute, please read the [Contributing Code][1] part of the documentation. If you're submitting a pull request, please follow the guidelines in the [Submitting a Patch][2] section and use the [Pull Request Template][3]. diff --git a/project/README.md.twig b/project/README.md.twig index b247c5f81..bda0572a7 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -18,7 +18,7 @@ Branch | Travis | Coveralls | {% endif %} {{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | -This bundle is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed +This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). {{ description }} @@ -41,7 +41,7 @@ See also: * [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference * [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links - +{{ docs_extra|raw }} ## Support For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/symfony-cmf). @@ -52,7 +52,7 @@ Pull requests are welcome. Please see our [CONTRIBUTING](https://github.com/symfony-cmf/symfony-cmf/blob/master/CONTRIBUTING.md) guide. -Unit and/or functional tests exist for this bundle. See the +Unit and/or functional tests exist for this package. See the [Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) for a guide to running the tests. diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index aedb0b080..431d9ef8d 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -62,6 +62,7 @@ public function getConfigTreeBuilder() ->append($this->addVersionsNode()) ->append($this->addFailingVersionsNode()) ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() + ->scalarNode('docs_extra')->defaultValue('')->end() ->arrayNode('make_tasks') ->prototype('scalar') ->defaultValue([]) From beb11949aa2c02f0fd13351d076966dbc9af8be6 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 24 Oct 2017 06:27:02 +0200 Subject: [PATCH 15/39] add resource-bundle --- config/projects.yml | 113 ++++++++++----------------- project/.travis.yml.twig | 11 ++- src/Config/ProjectsConfiguration.php | 1 + 3 files changed, 51 insertions(+), 74 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 0e2f845f0..7475f72ec 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -90,6 +90,20 @@ routing: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +routing-auto: + description: | + This component automatically creates and manages routes for configured persisted document classes. + This library contains all implementation agnostic code. + branches: + master: + docs_path: 'components/routing' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. @@ -111,79 +125,36 @@ resource-rest-bundle: branches: master: docs_path: 'bundles/resource-rest' - docs_extra: | - ## Example + php: ['7.0', '7.1'] + make_tasks: + unit_tests: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] +resource-bundle: + description: | + This bundle provides *object* resource location services based on Puli. - ````bash - $ curl http://localhost:8000/api/phpcrodm_repo/foo | python -m json.tool - { - "_links": { - "self": { - "href": "/api/phpcrodm_repo/foo" - } - }, - "children": { - "bar": { - "_links": { - "self": { - "href": "/api/phpcrodm_repo/foo/bar" - } - }, - "children": [], - "document": { - "_links": { - "self": { - "href": "/path/to/this" - } - }, - "body": "This is my second article", - "id": "/tests/cmf/articles/foo/bar", - "title": "Article 2" - }, - "path": "/foo/bar", - "repo_path": "/foo/bar" - }, - "boo": { - "_links": { - "self": { - "href": "/api/phpcrodm_repo/foo/boo" - } - }, - "children": [], - "document": { - "_links": { - "self": { - "href": "/path/to/this" - } - }, - "body": "This is my third article", - "id": "/tests/cmf/articles/foo/boo", - "title": "Article 2" - }, - "path": "/foo/boo", - "repo_path": "/foo/boo" - } - }, - "document": { - "_links": { - "self": { - "href": "/path/to/this" - } - }, - "body": "This is my article", - "id": "/tests/cmf/articles/foo", - "title": "Article 1" - }, - "path": "/foo", - "repo_path": "/foo" - } - ```` - ## Running the tests + Examples: - ### Behat - - Setup database: `./vendor/symfony-cmf/testing/bin/travis/phpcr_odm_doctrine_dbal.sh` - - Run server: `./vendor/symfony-cmf/testing/bin/server` - - Run tests: `./vendor/bin/behat` + - **Static document path mapping**: Map the path `/routes` to `/cms/routes` + - **Dynamic document resolution**: Map the path `/routes` to `/cms//routes`. + - **Access documents at a static location**: Map `/role/menu/main` to `/cms/menus/main-menu`. + + The first example could use the existing CMF base route configuration to + resolve paths. + + The benefit of the above two examples would be most strongly felt in + association with another component which would provide a context for the + document resource resolution. + + For example, a `Site` which is matched against the incoming hostname would + provide the context with which to resolve the documents. + branches: + master: + docs_path: 'bundles/resource-rest' php: ['7.0', '7.1'] make_tasks: unit_tests: ~ diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 11876e144..dc0f22ebc 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -29,7 +29,10 @@ env: matrix: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} global: - SYMFONY_DEPRECATIONS_HELPER=48 - - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" SYMFONY_PHPUNIT_VERSION=5.7 + - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" +{% if phpunit_version %} + - SYMFONY_PHPUNIT_VERSION={{ phpunit_version }} +{% endif %} - TEST_INSTALLATION=false matrix: @@ -53,14 +56,16 @@ matrix: {% endfor %} {% endfor %} {% endif %} - +{% if make_tasks.test_installation is defined %} - env: TEST_INSTALLATION=true +{% endif %} + fast_finish: true allow_failures: - php: {{ php|last }} env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* {% if make_tasks.test_installation is defined %} -- env: TEST_INSTALLATION=true + - env: TEST_INSTALLATION=true {% endif %} diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 431d9ef8d..a2609770e 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -63,6 +63,7 @@ public function getConfigTreeBuilder() ->append($this->addFailingVersionsNode()) ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() ->scalarNode('docs_extra')->defaultValue('')->end() + ->scalarNode('phpunit_version')->defaultValue('5.7')->end() ->arrayNode('make_tasks') ->prototype('scalar') ->defaultValue([]) From 555f0bfe73126f8a4dc7e29d61478420936d42d2 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 24 Oct 2017 08:32:15 +0200 Subject: [PATCH 16/39] add resource-bundle --- config/projects.yml | 17 +++++++++++++++++ project/.travis.yml.twig | 6 ++++++ project/Makefile.twig | 1 + 3 files changed, 24 insertions(+) diff --git a/config/projects.yml b/config/projects.yml index 7475f72ec..c67f7db82 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -158,8 +158,25 @@ resource-bundle: php: ['7.0', '7.1'] make_tasks: unit_tests: ~ + functional_tests_phpcr: ~ test_installation: ~ versions: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +resource: + excluded_files: + - .travis.yml.twig + description: | + The Resource component provides PHPCR/ODM integration with Puli. + + > **CAUTION** As Puli is not yet stable, the complete component is marked + > internal. Backwards compatibility of upcoming 1.x versions is not + > guaranteed. + + branches: + master: + docs_path: 'components/resource' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index dc0f22ebc..55270210b 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -26,10 +26,16 @@ cache: - $HOME/.composer/cache/files env: +{% if failing_allowed_versions.symfony|length > 0 %} matrix: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} +{% elseif versions.symfony|length > 0 %} + matrix: SYMFONY_VERSION={{ versions.symfony|first }} +{% endif %} global: +{% if failing_allowed_versions.symfony|length > 0 or versions.symfony|length > 0 %} - SYMFONY_DEPRECATIONS_HELPER=48 - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" +{% endif %} {% if phpunit_version %} - SYMFONY_PHPUNIT_VERSION={{ phpunit_version }} {% endif %} diff --git a/project/Makefile.twig b/project/Makefile.twig index b3b3bcd73..a1a5f7756 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -35,5 +35,6 @@ list: include ${TESTING_SCRIPTS_DIR}/make/{{ test }}.mk {% endfor %} +.PHONY: test test:{% for test, value in make_tasks if test != 'test_installation' %} {{ test }}{% endfor %} From 33374c61d9ac709985c47a5ac698b13d965982c9 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 24 Oct 2017 08:38:15 +0200 Subject: [PATCH 17/39] output description in raw --- project/README.md.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/README.md.twig b/project/README.md.twig index bda0572a7..5c94915f9 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -21,7 +21,7 @@ Branch | Travis | Coveralls | This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). -{{ description }} +{{ description|raw }} ## Requirements From 322c613ace448c0a16ce032953e729a734c0a4de Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 27 Oct 2017 09:03:27 +0200 Subject: [PATCH 18/39] add sonata-phpcr-admin bundle --- config/projects.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/config/projects.yml b/config/projects.yml index c67f7db82..4d9914126 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -164,6 +164,20 @@ resource-bundle: symfony: ['2.8', '3.1', '3.2', '3.3'] failing_allowed_versions: symfony: ['3.4'] +sonata-phpcr-admin-integration-bundle: + description: "" + branches: + master: + docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' + php: ['7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8', '3.1', '3.2', '3.3'] + failing_allowed_versions: + symfony: ['3.4'] resource: excluded_files: - .travis.yml.twig From b492c11492c6393272ed97d97c6d5fce7f9535fd Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 27 Oct 2017 21:55:40 +0200 Subject: [PATCH 19/39] testing, tree-browser-bundle and routing-auto-bundle --- config/projects.yml | 87 +++++++++++++++++++++++++++++++--------- project/.travis.yml.twig | 14 +++---- project/Makefile.twig | 4 ++ project/README.md.twig | 2 +- 4 files changed, 79 insertions(+), 28 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 4d9914126..ef1d3f871 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -12,9 +12,9 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -29,9 +29,9 @@ core-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. @@ -44,9 +44,9 @@ menu-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] routing-bundle: description: | The RoutingBundle enables the @@ -63,9 +63,9 @@ routing-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -87,9 +87,9 @@ routing: make_tasks: unit_tests: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. @@ -101,9 +101,9 @@ routing-auto: make_tasks: unit_tests: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. @@ -116,9 +116,24 @@ content-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] +routing-auto-bundle: + description: | + This bundle automatically creates and manages routes for configured persisted document classes. + branches: + master: + docs_path: 'bundles/routing-auto-bundle' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + failing_allowed_versions: + symfony: ['^3.4@dev'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. @@ -130,9 +145,9 @@ resource-rest-bundle: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -161,9 +176,9 @@ resource-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] sonata-phpcr-admin-integration-bundle: description: "" branches: @@ -175,9 +190,9 @@ sonata-phpcr-admin-integration-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8', '3.1', '3.2', '3.3'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] failing_allowed_versions: - symfony: ['3.4'] + symfony: ['^3.4@dev'] resource: excluded_files: - .travis.yml.twig @@ -194,3 +209,35 @@ resource: php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ +testing: + description: | + **NOTE**: This is an internal tool and is not intended to be used outside of + the context of the CMF. + + branches: + master: + docs_path: 'components/testing' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + versions: + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + failing_allowed_versions: + symfony: ['^3.4@dev'] + +tree-browser-bundle: + excluded_files: + - .travis.yml.twig + description: | + The TreeBrowserBundle provides tree navigation for the Content Repository. + + branches: + master: + docs_path: 'bundle/tree-browser-bundle' + php: ['5.6', '7.0', '7.1'] + make_tasks: + unit_tests: ~ + versions: + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + failing_allowed_versions: + symfony: ['^3.4@dev'] \ No newline at end of file diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 55270210b..f79081f5f 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -33,7 +33,7 @@ env: {% endif %} global: {% if failing_allowed_versions.symfony|length > 0 or versions.symfony|length > 0 %} - - SYMFONY_DEPRECATIONS_HELPER=48 + - SYMFONY_DEPRECATIONS_HELPER=24 - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" {% endif %} {% if phpunit_version %} @@ -44,21 +44,21 @@ env: matrix: include: - php: {{ php|last }} - env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* + env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} - php: {{ php|last }} - env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }}.* + env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }}.* SYMFONY_DEPRECATIONS_HELPER=weak + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: SYMFONY_VERSION={{ version }}.* + env: SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: SYMFONY_VERSION={{ version }}.* + env: SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} @@ -69,7 +69,7 @@ matrix: fast_finish: true allow_failures: - php: {{ php|last }} - env: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }}.* + env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% if make_tasks.test_installation is defined %} - env: TEST_INSTALLATION=true {% endif %} diff --git a/project/Makefile.twig b/project/Makefile.twig index a1a5f7756..64d8996f1 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -13,7 +13,11 @@ # file that was distributed with this source code. # ############################################################################ +ifeq ("{{ packagist_name }}", "symfony-cmf/testing") +TESTING_SCRIPTS_DIR=bin +else TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin +endif CONSOLE=${TESTING_SCRIPTS_DIR}/console VERSION=dev-master ifdef BRANCH diff --git a/project/README.md.twig b/project/README.md.twig index 5c94915f9..c666b1d1d 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -27,7 +27,7 @@ under the [MIT License](LICENSE). * PHP {% for version in php %}{{ version }}{% if version != php|last %} / {% endif %}{% endfor %} -* Symfony {% for version in versions.symfony %}{{ version }}{% if version != versions.symfony|last %} / {% endif %}{% endfor %} +* Symfony {% for version in versions.symfony %}{{ version|replace({'.*': ''}) }}{% if version != versions.symfony|last %} / {% endif %}{% endfor %} * See also the `require` section of [composer.json](composer.json) From 3c9d4a36f6e3d3337aae8d11c2a7b51bebcea418 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Mon, 6 Nov 2017 07:02:07 +0100 Subject: [PATCH 20/39] new app structure on content bundle --- config/projects.yml | 74 ++++++++++++++++++---------- project/.travis.yml.twig | 13 ++--- project/Makefile.twig | 10 ++-- src/Config/ProjectsConfiguration.php | 2 + 4 files changed, 62 insertions(+), 37 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index ef1d3f871..915b1d3e6 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -5,6 +5,8 @@ seo-bundle: branches: master: docs_path: 'bundles/seo' + test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\App\Kernel' + deprecation_warnings: 0 php: ['7.1'] make_tasks: unit_tests: ~ @@ -12,9 +14,9 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4.0@dev'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -23,30 +25,35 @@ core-bundle: branches: master: docs_path: 'bundles/core' + test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\App\AppKernel + test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\App\AppKernel + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: docs_path: 'bundles/menu' + deprecation_warnings: 0 + test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\App\AppKernel php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] routing-bundle: description: | The RoutingBundle enables the @@ -56,6 +63,8 @@ routing-bundle: branches: master: docs_path: 'bundles/routing' + deprecation_warnings: 0 + test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\App\AppKernel php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ @@ -63,9 +72,9 @@ routing-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -83,13 +92,14 @@ routing: branches: master: docs_path: 'components/routing' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. @@ -97,57 +107,62 @@ routing-auto: branches: master: docs_path: 'components/routing' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. branches: master: docs_path: 'bundles/routing' + deprecation_warnings: 0 + test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] routing-auto-bundle: description: | This bundle automatically creates and manages routes for configured persisted document classes. branches: master: docs_path: 'bundles/routing-auto-bundle' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. branches: master: docs_path: 'bundles/resource-rest' + deprecation_warnings: 0 php: ['7.0', '7.1'] make_tasks: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -170,29 +185,32 @@ resource-bundle: branches: master: docs_path: 'bundles/resource-rest' + deprecation_warnings: 0 + test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\App\AppKernel php: ['7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] sonata-phpcr-admin-integration-bundle: description: "" branches: master: docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' + deprecation_warnings: 0 php: ['7.0', '7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] + symfony: ['^4@dev'] resource: excluded_files: - .travis.yml.twig @@ -206,6 +224,7 @@ resource: branches: master: docs_path: 'components/resource' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ @@ -217,14 +236,14 @@ testing: branches: master: docs_path: 'components/testing' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] - + symfony: ['^4@dev'] tree-browser-bundle: excluded_files: - .travis.yml.twig @@ -234,10 +253,11 @@ tree-browser-bundle: branches: master: docs_path: 'bundle/tree-browser-bundle' + deprecation_warnings: 0 php: ['5.6', '7.0', '7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*'] + symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^3.4@dev'] \ No newline at end of file + symfony: ['^4@dev'] \ No newline at end of file diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index f79081f5f..a629bfb29 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -26,16 +26,17 @@ cache: - $HOME/.composer/cache/files env: -{% if failing_allowed_versions.symfony|length > 0 %} - matrix: SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} -{% elseif versions.symfony|length > 0 %} - matrix: SYMFONY_VERSION={{ versions.symfony|first }} -{% endif %} +{% if versions.symfony|length > 0 %} + matrix: SYMFONY_VERSION={{ versions.symfony|last }} global: +{% endif %} {% if failing_allowed_versions.symfony|length > 0 or versions.symfony|length > 0 %} - - SYMFONY_DEPRECATIONS_HELPER=24 + - SYMFONY_DEPRECATIONS_HELPER={{ deprecation_warnings }} - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" {% endif %} +{% if test_kernel %} + - KERNEL_CLASS={{ test_kernel }} +{% endif %} {% if phpunit_version %} - SYMFONY_PHPUNIT_VERSION={{ phpunit_version }} {% endif %} diff --git a/project/Makefile.twig b/project/Makefile.twig index 64d8996f1..5e555d82e 100644 --- a/project/Makefile.twig +++ b/project/Makefile.twig @@ -13,18 +13,20 @@ # file that was distributed with this source code. # ############################################################################ -ifeq ("{{ packagist_name }}", "symfony-cmf/testing") +{% if packagist_name == "symfony-cmf/testing" %} TESTING_SCRIPTS_DIR=bin -else +{% else %} TESTING_SCRIPTS_DIR=vendor/symfony-cmf/testing/bin -endif +{% endif %} CONSOLE=${TESTING_SCRIPTS_DIR}/console VERSION=dev-master ifdef BRANCH VERSION=dev-${BRANCH} endif PACKAGE={{ packagist_name }} - +{% if test_kernel %} +export KERNEL_CLASS={{ test_kernel }} +{% endif %} list: @echo 'test: will run all tests' {% if make_tasks.unit_tests is defined %} @echo 'unit_tests: will run unit tests only'{% endif %} diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index a2609770e..67be6aa86 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -61,6 +61,8 @@ public function getConfigTreeBuilder() ->scalarNode('target_php')->defaultNull()->end() ->append($this->addVersionsNode()) ->append($this->addFailingVersionsNode()) + ->scalarNode('test_kernel')->defaultNull()->end() + ->scalarNode('deprecation_warnings')->defaultValue(24)->end() ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() ->scalarNode('docs_extra')->defaultValue('')->end() ->scalarNode('phpunit_version')->defaultValue('5.7')->end() From 97754fe24eabbaba1ed4eeaceb24d37c648a89a8 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 16 Nov 2017 05:25:03 +0100 Subject: [PATCH 21/39] most bundles have new app kernel and reduced php and symfony versions --- config/projects.yml | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 915b1d3e6..7c5a61b76 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -5,7 +5,7 @@ seo-bundle: branches: master: docs_path: 'bundles/seo' - test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\App\Kernel' + test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' deprecation_warnings: 0 php: ['7.1'] make_tasks: @@ -14,7 +14,7 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4.0@dev'] core-bundle: @@ -25,16 +25,15 @@ core-bundle: branches: master: docs_path: 'bundles/core' - test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\App\AppKernel - test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\App\AppKernel + test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] menu-bundle: @@ -44,14 +43,14 @@ menu-bundle: master: docs_path: 'bundles/menu' deprecation_warnings: 0 - test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\App\AppKernel - php: ['5.6', '7.0', '7.1'] + test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] routing-bundle: @@ -64,15 +63,15 @@ routing-bundle: master: docs_path: 'bundles/routing' deprecation_warnings: 0 - test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\App\AppKernel - php: ['5.6', '7.0', '7.1'] + test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] routing: @@ -123,13 +122,13 @@ content-bundle: docs_path: 'bundles/routing' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] routing-auto-bundle: @@ -138,14 +137,15 @@ routing-auto-bundle: branches: master: docs_path: 'bundles/routing-auto-bundle' + test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] resource-rest-bundle: @@ -186,14 +186,14 @@ resource-bundle: master: docs_path: 'bundles/resource-rest' deprecation_warnings: 0 - test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\App\AppKernel - php: ['7.0', '7.1'] + test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] sonata-phpcr-admin-integration-bundle: @@ -237,13 +237,11 @@ testing: master: docs_path: 'components/testing' deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4@dev'] tree-browser-bundle: excluded_files: - .travis.yml.twig From 4092d35147375b53be75dd5d229fea3e0284dbfe Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 16 Nov 2017 21:24:34 +0100 Subject: [PATCH 22/39] make them equal --- config/projects.yml | 78 +++++++++++++++++++++++++++++++++------------ 1 file changed, 57 insertions(+), 21 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 7c5a61b76..b5105a838 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -36,6 +36,27 @@ core-bundle: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: symfony: ['^4@dev'] +block-bundle: + description: | + The BlockBundle provides integration with + [SonataBlockBundle](https://github.com/sonata-project/SonataBlockBundle). + It is used to manage fragments of content, so-called blocks, that are persisted + in a database and can be incorporated into any page layout. The BlockBundle also + provides a few commonly used standard blocks, including the ability to edit them. + branches: + master: + docs_path: 'bundles/block' + test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel + deprecation_warnings: 0 + php: ['7.1'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + test_installation: ~ + versions: + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] + failing_allowed_versions: + symfony: ['^4.0@dev'] menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. @@ -52,7 +73,7 @@ menu-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] routing-bundle: description: | The RoutingBundle enables the @@ -73,7 +94,7 @@ routing-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -92,13 +113,13 @@ routing: master: docs_path: 'components/routing' deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. @@ -107,13 +128,13 @@ routing-auto: master: docs_path: 'components/routing' deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. @@ -130,7 +151,7 @@ content-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] routing-auto-bundle: description: | This bundle automatically creates and manages routes for configured persisted document classes. @@ -147,22 +168,35 @@ routing-auto-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. + + #### Running Behat + + 1. Run web server: + ``` + KERNEL_CLASS="Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel" ./vendor/symfony-cmf/testing/bin/console server:run -d vendor/symfony-cmf/testing/resources/web/ 8000 + ``` + 2. Run the behat tests: + ``` + KERNEL_CLASS="Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel" ./vendor/bin/behat + ``` + branches: master: docs_path: 'bundles/resource-rest' deprecation_warnings: 0 - php: ['7.0', '7.1'] + test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel + php: ['7.1'] make_tasks: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -182,6 +216,7 @@ resource-bundle: For example, a `Site` which is matched against the incoming hostname would provide the context with which to resolve the documents. + branches: master: docs_path: 'bundles/resource-rest' @@ -195,22 +230,23 @@ resource-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] sonata-phpcr-admin-integration-bundle: description: "" branches: master: docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' + test_kernel: Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 - php: ['7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*','3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] resource: excluded_files: - .travis.yml.twig @@ -225,7 +261,7 @@ resource: master: docs_path: 'components/resource' deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ testing: @@ -252,10 +288,10 @@ tree-browser-bundle: master: docs_path: 'bundle/tree-browser-bundle' deprecation_warnings: 0 - php: ['5.6', '7.0', '7.1'] + php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.1.*', '3.2.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] \ No newline at end of file + symfony: ['^4.0@dev'] \ No newline at end of file From 8322589fc942ca1636d1d3d76d8c1fccdc4975a7 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 30 Nov 2017 14:59:40 +0100 Subject: [PATCH 23/39] add posibility to manipulate composer.json also --- config/projects.yml | 51 ++++++-------------- project/.travis.yml.twig | 4 ++ src/Console/Command/DispatchCommand.php | 64 +++++++++++++++++++++++++ 3 files changed, 83 insertions(+), 36 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index b5105a838..972e99d9f 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -14,9 +14,7 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -35,7 +33,7 @@ core-bundle: versions: symfony: ['2.8.*', '3.3.*', '^3.4@dev'] failing_allowed_versions: - symfony: ['^4@dev'] + symfony: ['^4.0@dev'] block-bundle: description: | The BlockBundle provides integration with @@ -54,9 +52,7 @@ block-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. @@ -71,9 +67,7 @@ menu-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] routing-bundle: description: | The RoutingBundle enables the @@ -92,9 +86,7 @@ routing-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev', '^4.0@dev'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -117,9 +109,7 @@ routing: make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev',] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. @@ -132,9 +122,7 @@ routing-auto: make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. @@ -149,9 +137,7 @@ content-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] routing-auto-bundle: description: | This bundle automatically creates and manages routes for configured persisted document classes. @@ -166,9 +152,7 @@ routing-auto-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. @@ -194,9 +178,7 @@ resource-rest-bundle: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -228,9 +210,7 @@ resource-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] sonata-phpcr-admin-integration-bundle: description: "" branches: @@ -244,7 +224,7 @@ sonata-phpcr-admin-integration-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*','3.3.*', '^3.4@dev'] + symfony: ['2.8.*','3.3.*', '^3.4@dev', '^4.0@dev'] failing_allowed_versions: symfony: ['^4.0@dev'] resource: @@ -277,7 +257,7 @@ testing: make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4@dev'] + symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] tree-browser-bundle: excluded_files: - .travis.yml.twig @@ -291,7 +271,6 @@ tree-browser-bundle: php: ['7.1'] make_tasks: unit_tests: ~ + test_installation: ~ versions: - symfony: ['2.8.*', '^3.4@dev'] - failing_allowed_versions: - symfony: ['^4.0@dev'] \ No newline at end of file + symfony: ['2.8.*', '^3.4@dev', '^4.0@dev'] \ No newline at end of file diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index a629bfb29..30c7ba237 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -44,8 +44,10 @@ env: matrix: include: +{% if failing_allowed_versions.symfony is defined %} - php: {{ php|last }} env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} +{% endif %} - php: {{ php|last }} env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} @@ -69,8 +71,10 @@ matrix: fast_finish: true allow_failures: +{% if failing_allowed_versions.symfony is defined %} - php: {{ php|last }} env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} +{% endif %} {% if make_tasks.test_installation is defined %} - env: TEST_INSTALLATION=true {% endif %} diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index 815ece10b..ebdb0fb13 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -401,6 +401,8 @@ private function dispatchFiles(Package $package) $this->renderFile($package, $repositoryName, 'project', $clonePath, $projectConfig, $currentBranch); + $this->setVersionConstraintsInComposer($clonePath, $projectConfig, $currentBranch); + $git->add('.', ['all' => true])->getOutput(); $diff = $git->diff('--color', '--cached')->getOutput(); @@ -540,4 +542,66 @@ private function renderFile( // Restore file permissions after content copy $this->fileSystem->chmod($distPath, fileperms($localPath)); } + + /** + * @param string $path + * @param array $projectConfig + * + * @throws \Exception + */ + private function setVersionConstraintsInComposer($path, array $projectConfig, $currentBranch) + { + $filePath = $path.'/composer.json'; + if (!$this->fileSystem->exists($filePath)) { + throw new \Exception('No composer.json found at: '.$filePath); + } + $composerAsString = file_get_contents($filePath); + $composerAsJson = json_decode($composerAsString, true); + if (!isset($composerAsJson['require'])) { + throw new \Exception('no require path found in composer.json at: '.$filePath); + } + + $branchConfig = $projectConfig['branches'][$currentBranch]; + $composerAsJson['require']['php'] = $this->evaluateVersionString($branchConfig['php']); + foreach ($composerAsJson['require'] as $package => $version) { + if (preg_match('/symfony\//', $package)) { + $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + } + } + foreach ($composerAsJson['require-dev'] as $package => $version) { + if (preg_match('/symfony\//', $package)) { + $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + } + } + $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); + $composerAsString = str_replace('\/', '/', $composerAsString); + $composerAsString .= PHP_EOL; + file_put_contents($filePath, $composerAsString); + } + + /** + * Creates a string for version constraint with different major versions allowed. + * + * @param array $versions + * + * @return string + */ + private function evaluateVersionString(array $versions) + { + $sortedVersions = []; + foreach ($versions as $version) { + $version = trim($version, '@dev^'); + list($major, $minor) = explode('.', $version); + $sortedVersions[$major][] = $minor; + } + + $versionConstraintString = ''; + foreach ($sortedVersions as $major => $minorVersions) { + sort($minorVersions); + $firstMinorVersion = array_shift($minorVersions); + $versionConstraintString .= ' || ^' . $major . '.' . $firstMinorVersion; + } + + return trim($versionConstraintString, ' || '); + } } From a05bbbe631c82e8c4577488d2f43f6ea65f5df3f Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 30 Nov 2017 15:06:05 +0100 Subject: [PATCH 24/39] latest versions fix --- config/projects.yml | 2 +- src/Console/Command/DispatchCommand.php | 16 +++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 972e99d9f..a176ff7e7 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -273,4 +273,4 @@ tree-browser-bundle: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '^3.4@dev', '^4.0@dev'] \ No newline at end of file + symfony: ['2.8.*', '3.3', '^3.4@dev', '^4.0@dev'] \ No newline at end of file diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index ebdb0fb13..bde1e97e8 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -563,14 +563,16 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c $branchConfig = $projectConfig['branches'][$currentBranch]; $composerAsJson['require']['php'] = $this->evaluateVersionString($branchConfig['php']); - foreach ($composerAsJson['require'] as $package => $version) { - if (preg_match('/symfony\//', $package)) { - $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + if (isset($branchConfig['versions']['symfony'])) { + foreach ($composerAsJson['require'] as $package => $version) { + if (preg_match('/symfony\//', $package)) { + $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + } } - } - foreach ($composerAsJson['require-dev'] as $package => $version) { - if (preg_match('/symfony\//', $package)) { - $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + foreach ($composerAsJson['require-dev'] as $package => $version) { + if (preg_match('/symfony\//', $package)) { + $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + } } } $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); From f27ec92b3615fde2ff506af9c9dc2bf7a1ab7a90 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 1 Dec 2017 05:06:05 +0100 Subject: [PATCH 25/39] dev mode for dev phase --- config/projects.yml | 47 ++++++++++++++++--------- project/.travis.yml.twig | 8 ++--- src/Config/ProjectsConfiguration.php | 1 + src/Console/Command/DispatchCommand.php | 11 ++++++ 4 files changed, 46 insertions(+), 21 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index a176ff7e7..dd21e8f59 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -4,6 +4,7 @@ seo-bundle: aware for Search Engine Optimisation (SEO). branches: master: + dependency_mode: dev docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' deprecation_warnings: 0 @@ -14,7 +15,7 @@ seo-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -22,6 +23,7 @@ core-bundle: a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. branches: master: + dependency_mode: dev docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -31,9 +33,9 @@ core-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*'] failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['4.0.*'] block-bundle: description: | The BlockBundle provides integration with @@ -43,6 +45,7 @@ block-bundle: provides a few commonly used standard blocks, including the ability to edit them. branches: master: + dependency_mode: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -52,12 +55,13 @@ block-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: + dependency_mode: dev docs_path: 'bundles/menu' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel @@ -67,7 +71,7 @@ menu-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] routing-bundle: description: | The RoutingBundle enables the @@ -76,6 +80,7 @@ routing-bundle: controller for redirection routes. branches: master: + dependency_mode: dev docs_path: 'bundles/routing' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel @@ -86,7 +91,7 @@ routing-bundle: functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*', '4.0.*'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -103,31 +108,34 @@ routing: when building Symfony full stack applications. branches: master: + dependency_mode: dev docs_path: 'components/routing' deprecation_warnings: 0 php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev',] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*',] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. This library contains all implementation agnostic code. branches: master: + dependency_mode: dev docs_path: 'components/routing' deprecation_warnings: 0 php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. branches: master: + dependency_mode: dev docs_path: 'bundles/routing' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel @@ -137,12 +145,13 @@ content-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] routing-auto-bundle: description: | This bundle automatically creates and manages routes for configured persisted document classes. branches: master: + dependency_mode: dev docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -152,7 +161,7 @@ routing-auto-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. @@ -170,6 +179,7 @@ resource-rest-bundle: branches: master: + dependency_mode: dev docs_path: 'bundles/resource-rest' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel @@ -178,7 +188,7 @@ resource-rest-bundle: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -201,6 +211,7 @@ resource-bundle: branches: master: + dependency_mode: dev docs_path: 'bundles/resource-rest' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel @@ -210,11 +221,12 @@ resource-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] sonata-phpcr-admin-integration-bundle: description: "" branches: master: + dependency_mode: dev docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' test_kernel: Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -224,9 +236,9 @@ sonata-phpcr-admin-integration-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*','3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*','3.3.*', '3.4.*', '4.0.*'] failing_allowed_versions: - symfony: ['^4.0@dev'] + symfony: ['4.0.*'] resource: excluded_files: - .travis.yml.twig @@ -239,6 +251,7 @@ resource: branches: master: + dependency_mode: dev docs_path: 'components/resource' deprecation_warnings: 0 php: ['7.1'] @@ -251,13 +264,14 @@ testing: branches: master: + dependency_mode: dev docs_path: 'components/testing' deprecation_warnings: 0 php: ['7.1'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '^3.4@dev', '^4.0@dev'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] tree-browser-bundle: excluded_files: - .travis.yml.twig @@ -266,6 +280,7 @@ tree-browser-bundle: branches: master: + dependency_mode: dev docs_path: 'bundle/tree-browser-bundle' deprecation_warnings: 0 php: ['7.1'] @@ -273,4 +288,4 @@ tree-browser-bundle: unit_tests: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3', '^3.4@dev', '^4.0@dev'] \ No newline at end of file + symfony: ['2.8.*', '3.3', '3.4.*', '4.0.*'] \ No newline at end of file diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 30c7ba237..89ac8275a 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -49,26 +49,25 @@ matrix: env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} - php: {{ php|last }} - env: DEPS=dev SYMFONY_VERSION={{ versions.symfony|last }} + env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: SYMFONY_VERSION={{ version }} + env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: SYMFONY_VERSION={{ version }} + env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} {% if make_tasks.test_installation is defined %} - env: TEST_INSTALLATION=true {% endif %} - fast_finish: true allow_failures: {% if failing_allowed_versions.symfony is defined %} @@ -79,7 +78,6 @@ matrix: - env: TEST_INSTALLATION=true {% endif %} - before_install: - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi - phpenv config-rm xdebug.ini || true diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 67be6aa86..96a823458 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -56,6 +56,7 @@ public function getConfigTreeBuilder() ->defaultValue([]) ->prototype('array') ->children() + ->scalarNode('dependency_mode')->defaultValue('prod')->end() ->arrayNode('php')->prototype('scalar')->defaultValue([])->end()->end() ->arrayNode('services')->prototype('scalar')->defaultValue([])->end()->end() ->scalarNode('target_php')->defaultNull()->end() diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index bde1e97e8..b2fdf5b4f 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -563,6 +563,8 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c $branchConfig = $projectConfig['branches'][$currentBranch]; $composerAsJson['require']['php'] = $this->evaluateVersionString($branchConfig['php']); + + // set version constraints for symfony dependencies if (isset($branchConfig['versions']['symfony'])) { foreach ($composerAsJson['require'] as $package => $version) { if (preg_match('/symfony\//', $package)) { @@ -575,6 +577,15 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c } } } + + // remove minimum stability as we should set it via travis for specific builds or require @dev + if (isset($composerAsJson['minimum-stability'])) { + unset($composerAsJson['minimum-stability']); + } + if (isset($composerAsJson['prefer-stable'])) { + unset($composerAsJson['prefer-stable']); + } + $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); $composerAsString = str_replace('\/', '/', $composerAsString); $composerAsString .= PHP_EOL; From 3084f7df03d4f62458c8a96ca47839daa6e1a7e6 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 1 Dec 2017 05:13:42 +0100 Subject: [PATCH 26/39] remove hhvm condition from travis --- project/.travis.yml.twig | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 89ac8275a..b6eb9c74b 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -49,19 +49,19 @@ matrix: env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} - php: {{ php|last }} - env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ versions.symfony|last }} + env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ version }} + env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: {{ if dependency_mode != 'prod' }}DEPS=dev{{ endif }} SYMFONY_VERSION={{ version }} + env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} @@ -79,7 +79,6 @@ matrix: {% endif %} before_install: - - if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi - phpenv config-rm xdebug.ini || true - composer self-update - if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi From 328add46cf564454bffb6c44bb3e994cc1d2200a Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 1 Dec 2017 15:36:17 +0100 Subject: [PATCH 27/39] fix link creation in readme, add nicer stability flag --- config/projects.yml | 30 ++++++++++++------------- project/.travis.yml.twig | 14 ++++++------ project/README.md.twig | 6 ++--- src/Config/ProjectsConfiguration.php | 2 +- src/Console/Command/DispatchCommand.php | 28 ++++++++++++++++++----- 5 files changed, 49 insertions(+), 31 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index dd21e8f59..0a213ee24 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -4,7 +4,7 @@ seo-bundle: aware for Search Engine Optimisation (SEO). branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' deprecation_warnings: 0 @@ -23,7 +23,7 @@ core-bundle: a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -45,7 +45,7 @@ block-bundle: provides a few commonly used standard blocks, including the ability to edit them. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -61,7 +61,7 @@ menu-bundle: The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/menu' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel @@ -80,7 +80,7 @@ routing-bundle: controller for redirection routes. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/routing' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel @@ -108,7 +108,7 @@ routing: when building Symfony full stack applications. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'components/routing' deprecation_warnings: 0 php: ['7.1'] @@ -122,7 +122,7 @@ routing-auto: This library contains all implementation agnostic code. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'components/routing' deprecation_warnings: 0 php: ['7.1'] @@ -135,7 +135,7 @@ content-bundle: The ContentBundle provides a document for static content and the controller to render it. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/routing' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel @@ -151,7 +151,7 @@ routing-auto-bundle: This bundle automatically creates and manages routes for configured persisted document classes. branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -179,7 +179,7 @@ resource-rest-bundle: branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/resource-rest' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel @@ -211,7 +211,7 @@ resource-bundle: branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/resource-rest' deprecation_warnings: 0 test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel @@ -226,7 +226,7 @@ sonata-phpcr-admin-integration-bundle: description: "" branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' test_kernel: Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel deprecation_warnings: 0 @@ -251,7 +251,7 @@ resource: branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'components/resource' deprecation_warnings: 0 php: ['7.1'] @@ -264,7 +264,7 @@ testing: branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'components/testing' deprecation_warnings: 0 php: ['7.1'] @@ -280,7 +280,7 @@ tree-browser-bundle: branches: master: - dependency_mode: dev + minimum_stability: dev docs_path: 'bundle/tree-browser-bundle' deprecation_warnings: 0 php: ['7.1'] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index b6eb9c74b..71ce96d96 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -46,22 +46,22 @@ matrix: include: {% if failing_allowed_versions.symfony is defined %} - php: {{ php|last }} - env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} + env: STABILITY=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} - php: {{ php|last }} - env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} + env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak + env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: {% if dependency_mode != 'prod' %}DEPS=dev{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} @@ -72,7 +72,7 @@ matrix: allow_failures: {% if failing_allowed_versions.symfony is defined %} - php: {{ php|last }} - env: DEPS=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} + env: STABILITY=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} {% if make_tasks.test_installation is defined %} - env: TEST_INSTALLATION=true @@ -81,7 +81,7 @@ matrix: before_install: - phpenv config-rm xdebug.ini || true - composer self-update - - if [ "$DEPS" = "dev" ]; then perl -pi -e 's/^}$/,"minimum-stability":"dev"}/' composer.json; fi + - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) diff --git a/project/README.md.twig b/project/README.md.twig index c666b1d1d..369bdec26 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -64,11 +64,11 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). [travis_legacy_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ legacy_branch }} -[travis_legacy_link]: https://travis-ci.org/symfony-cmf/{{ repository_name }} +[travis_legacy_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} [travis_stable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ stable_branch }} -[travis_stable_link]: https://travis-ci.org/symfony-cmf/{{ repository_name }} +[travis_stable_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} [travis_unstable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ unstable_branch }} -[travis_unstable_link]: https://travis-ci.org/symfony-cmf/{{ repository_name }} +[travis_unstable_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} [coveralls_legacy_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ legacy_branch }} [coveralls_legacy_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ legacy_branch }} diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 96a823458..d2cbab8eb 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -56,7 +56,7 @@ public function getConfigTreeBuilder() ->defaultValue([]) ->prototype('array') ->children() - ->scalarNode('dependency_mode')->defaultValue('prod')->end() + ->scalarNode('minimum_stability')->defaultValue('prod')->end() ->arrayNode('php')->prototype('scalar')->defaultValue([])->end()->end() ->arrayNode('services')->prototype('scalar')->defaultValue([])->end()->end() ->scalarNode('target_php')->defaultNull()->end() diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index b2fdf5b4f..fb83c13dd 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -567,13 +567,26 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c // set version constraints for symfony dependencies if (isset($branchConfig['versions']['symfony'])) { foreach ($composerAsJson['require'] as $package => $version) { - if (preg_match('/symfony\//', $package)) { + if ('symfony/monolog-bundle' === $package) { + $composerAsJson['require'][$package] = '~3.1'; + } elseif ('symfony/phpunit-bridge' === $package) { + $composerAsJson['require'][$package] = trim( + $this->evaluateVersionString($branchConfig['versions']['symfony']), + '^2.8 | ' + ); + } elseif (preg_match('/symfony\//', $package)) { $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); } } - foreach ($composerAsJson['require-dev'] as $package => $version) { - if (preg_match('/symfony\//', $package)) { - $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + if (isset($composerAsJson['require-dev'])) { + foreach ($composerAsJson['require-dev'] as $package => $version) { + if ('symfony/monolog-bundle' === $package) { + $composerAsJson['require-dev'][$package] = '~3.1'; + } elseif ('symfony/phpunit-bridge' === $package) { + $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony'], '3.2'); + } elseif (preg_match('/symfony\//', $package)) { + $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); + } } } } @@ -597,12 +610,17 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c * * @param array $versions * + * @param string $minimumVersion + * * @return string */ - private function evaluateVersionString(array $versions) + private function evaluateVersionString(array $versions, $minimumVersion = '1.0') { $sortedVersions = []; foreach ($versions as $version) { + if ($version < $minimumVersion) { + continue; + } $version = trim($version, '@dev^'); list($major, $minor) = explode('.', $version); $sortedVersions[$major][] = $minor; From 5083b71a81ed3d6c35f4f0fd8dc8be9d73d4d997 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Fri, 1 Dec 2017 17:07:31 +0100 Subject: [PATCH 28/39] do not change jsrouting-bundle's version --- config/projects.yml | 6 +----- project/README.md.twig | 28 ++++++++++++------------- src/Console/Command/DispatchCommand.php | 4 ++-- 3 files changed, 17 insertions(+), 21 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 0a213ee24..781963178 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -33,9 +33,7 @@ core-bundle: functional_tests_phpcr: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*'] - failing_allowed_versions: - symfony: ['4.0.*'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] block-bundle: description: | The BlockBundle provides integration with @@ -237,8 +235,6 @@ sonata-phpcr-admin-integration-bundle: test_installation: ~ versions: symfony: ['2.8.*','3.3.*', '3.4.*', '4.0.*'] - failing_allowed_versions: - symfony: ['4.0.*'] resource: excluded_files: - .travis.yml.twig diff --git a/project/README.md.twig b/project/README.md.twig index 369bdec26..6060fad81 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -49,7 +49,7 @@ For general support and questions, please use [StackOverflow](http://stackoverfl ## Contributing Pull requests are welcome. Please see our -[CONTRIBUTING](https://github.com/symfony-cmf/symfony-cmf/blob/master/CONTRIBUTING.md) +[CONTRIBUTING](https://github.com/symfony-cmf/blob/master/CONTRIBUTING.md) guide. Unit and/or functional tests exist for this package. See the @@ -63,16 +63,16 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_legacy_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ legacy_branch }} -[travis_legacy_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} -[travis_stable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ stable_branch }} -[travis_stable_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} -[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ unstable_branch }} -[travis_unstable_link]: https://travis-ci.org/symfony-cmf/{{ packagist_name }} - -[coveralls_legacy_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ legacy_branch }} -[coveralls_legacy_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ legacy_branch }} -[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ stable_branch }} -[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ stable_branch }} -[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ unstable_branch }} -[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ unstable_branch }} +[travis_legacy_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ legacy_branch }} +[travis_legacy_link]: https://travis-ci.org/{{ packagist_name }} +[travis_stable_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ stable_branch }} +[travis_stable_link]: https://travis-ci.org/{{ packagist_name }} +[travis_unstable_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ unstable_branch }} +[travis_unstable_link]: https://travis-ci.org/{{ packagist_name }} + +[coveralls_legacy_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ legacy_branch }} +[coveralls_legacy_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ legacy_branch }} +[coveralls_stable_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ stable_branch }} +[coveralls_stable_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ stable_branch }} +[coveralls_unstable_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ unstable_branch }} +[coveralls_unstable_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ unstable_branch }} diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index fb83c13dd..ffc4e0d6c 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -574,7 +574,7 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c $this->evaluateVersionString($branchConfig['versions']['symfony']), '^2.8 | ' ); - } elseif (preg_match('/symfony\//', $package)) { + } elseif (preg_match('/symfony\//', $package) && 'friendsofsymfony/jsrouting-bundle' !== $package) { $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); } } @@ -584,7 +584,7 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c $composerAsJson['require-dev'][$package] = '~3.1'; } elseif ('symfony/phpunit-bridge' === $package) { $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony'], '3.2'); - } elseif (preg_match('/symfony\//', $package)) { + } elseif (preg_match('/symfony\//', $package) && 'friendsofsymfony/jsrouting-bundle' !== $package) { $composerAsJson['require-dev'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); } } From d6bbdfcd72225245731c2e70c2c794329c58d7c5 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Thu, 7 Dec 2017 06:23:12 +0100 Subject: [PATCH 29/39] first packages with php 7.2 --- composer.json | 3 ++- config/projects.yml | 54 ++++++++++++++++++++-------------------- project/.travis.yml.twig | 4 +-- project/README.md.twig | 30 +++++++++++----------- 4 files changed, 45 insertions(+), 46 deletions(-) diff --git a/composer.json b/composer.json index c02ccde54..7bf863999 100644 --- a/composer.json +++ b/composer.json @@ -29,5 +29,6 @@ }, "autoload": { "psr-4": { "Sonata\\DevKit\\": "src" } - } + }, + "prefer-stable": true } diff --git a/config/projects.yml b/config/projects.yml index 781963178..59faf8319 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -7,8 +7,8 @@ seo-bundle: minimum_stability: dev docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -26,8 +26,8 @@ core-bundle: minimum_stability: dev docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -61,9 +61,9 @@ menu-bundle: master: minimum_stability: dev docs_path: 'bundles/menu' - deprecation_warnings: 0 + deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel - php: ['7.1'] + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -80,16 +80,16 @@ routing-bundle: master: minimum_stability: dev docs_path: 'bundles/routing' - deprecation_warnings: 0 + deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel - php: ['7.1'] + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ test_installation: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*', '4.0.*'] + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -108,8 +108,8 @@ routing: master: minimum_stability: dev docs_path: 'components/routing' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ versions: @@ -122,8 +122,8 @@ routing-auto: master: minimum_stability: dev docs_path: 'components/routing' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ versions: @@ -135,9 +135,9 @@ content-bundle: master: minimum_stability: dev docs_path: 'bundles/routing' - deprecation_warnings: 0 + deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel - php: ['7.1'] + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -152,8 +152,8 @@ routing-auto-bundle: minimum_stability: dev docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -179,9 +179,9 @@ resource-rest-bundle: master: minimum_stability: dev docs_path: 'bundles/resource-rest' - deprecation_warnings: 0 + deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel - php: ['7.1'] + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ test_installation: ~ @@ -211,9 +211,9 @@ resource-bundle: master: minimum_stability: dev docs_path: 'bundles/resource-rest' - deprecation_warnings: 0 + deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel - php: ['7.1'] + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -249,8 +249,8 @@ resource: master: minimum_stability: dev docs_path: 'components/resource' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ testing: @@ -262,8 +262,8 @@ testing: master: minimum_stability: dev docs_path: 'components/testing' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ versions: @@ -278,8 +278,8 @@ tree-browser-bundle: master: minimum_stability: dev docs_path: 'bundle/tree-browser-bundle' - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ test_installation: ~ diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 71ce96d96..ef15f7f8d 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -31,7 +31,7 @@ env: global: {% endif %} {% if failing_allowed_versions.symfony|length > 0 or versions.symfony|length > 0 %} - - SYMFONY_DEPRECATIONS_HELPER={{ deprecation_warnings }} + - SYMFONY_DEPRECATIONS_HELPER="{{ deprecation_warnings }}" - SYMFONY_PHPUNIT_DIR=.phpunit SYMFONY_PHPUNIT_REMOVE="symfony/yaml" {% endif %} {% if test_kernel %} @@ -81,7 +81,7 @@ matrix: before_install: - phpenv config-rm xdebug.ini || true - composer self-update - - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; fi; + - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; composer config prefer-stable true; fi; - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) diff --git a/project/README.md.twig b/project/README.md.twig index 6060fad81..b375207d3 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -11,12 +11,12 @@ Branch | Travis | Coveralls | ------ | ------ | --------- | {% if legacy_branch != stable_branch %} -{{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_legacy_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | +{{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | {% endif %} {% if unstable_branch != stable_branch %} -{{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | +{{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | {% endif %} -{{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | +{{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). @@ -63,16 +63,14 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -[travis_legacy_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ legacy_branch }} -[travis_legacy_link]: https://travis-ci.org/{{ packagist_name }} -[travis_stable_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ stable_branch }} -[travis_stable_link]: https://travis-ci.org/{{ packagist_name }} -[travis_unstable_badge]: https://travis-ci.org/{{ repository_name }}.svg?branch={{ unstable_branch }} -[travis_unstable_link]: https://travis-ci.org/{{ packagist_name }} - -[coveralls_legacy_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ legacy_branch }} -[coveralls_legacy_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ legacy_branch }} -[coveralls_stable_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ stable_branch }} -[coveralls_stable_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ stable_branch }} -[coveralls_unstable_badge]: https://coveralls.io/repos/github/{{ repository_name }}/badge.svg?branch={{ unstable_branch }} -[coveralls_unstable_link]: https://coveralls.io/github/{{ repository_name }}?branch={{ unstable_branch }} +[travis_legacy_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ legacy_branch }} +[travis_stable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ stable_branch }} +[travis_unstable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ unstable_branch }} +[travis_link]: https://travis-ci.org/{{ packagist_name }} + +[coveralls_legacy_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ legacy_branch }} +[coveralls_legacy_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ legacy_branch }} +[coveralls_stable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ stable_branch }} +[coveralls_stable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ stable_branch }} +[coveralls_unstable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ unstable_branch }} +[coveralls_unstable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ unstable_branch }} From f114ea72544b31d49115a0aae1f686712834520d Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sat, 9 Dec 2017 06:40:24 +0100 Subject: [PATCH 30/39] add symfony type information --- config/projects.yml | 4 ++-- src/Console/Command/DispatchCommand.php | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 59faf8319..b39e80efc 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -46,8 +46,8 @@ block-bundle: minimum_stability: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index ffc4e0d6c..39541aed7 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -599,6 +599,10 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c unset($composerAsJson['prefer-stable']); } + // add type information if not set + if (preg_match('/bundle/', $composerAsJson['name'])) { + $composerAsJson['type'] = 'symfony-bundle'; + } $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); $composerAsString = str_replace('\/', '/', $composerAsString); $composerAsString .= PHP_EOL; From 33798decc6b1e9ef4d657c8734ae14d9d85860c4 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sat, 9 Dec 2017 06:40:24 +0100 Subject: [PATCH 31/39] work on --- config/projects.yml | 6 +++--- project/.travis.yml.twig | 10 +++++----- src/Console/Command/DispatchCommand.php | 4 ++++ 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 59faf8319..f05ceed70 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -46,8 +46,8 @@ block-bundle: minimum_stability: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: 0 - php: ['7.1'] + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ @@ -106,7 +106,7 @@ routing: when building Symfony full stack applications. branches: master: - minimum_stability: dev + minimum_stability: alpha docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index ef15f7f8d..c3b4251e7 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -46,22 +46,22 @@ matrix: include: {% if failing_allowed_versions.symfony is defined %} - php: {{ php|last }} - env: STABILITY=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} + env: STABILITY={{ minimum_stability }} SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} - env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: {% if minimum_stability != 'prod' %}STABILITY=dev{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index ffc4e0d6c..39541aed7 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -599,6 +599,10 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c unset($composerAsJson['prefer-stable']); } + // add type information if not set + if (preg_match('/bundle/', $composerAsJson['name'])) { + $composerAsJson['type'] = 'symfony-bundle'; + } $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); $composerAsString = str_replace('\/', '/', $composerAsString); $composerAsString .= PHP_EOL; From 79559767b30100b84cf89a35ce65f8c4e96ff64c Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 9 May 2018 01:00:14 +0200 Subject: [PATCH 32/39] add new github templates --- config/projects.yml | 2 +- project/.github/Bug_report.md | 26 ++++++++++++++ project/.github/Documentation_issue.md | 15 +++++++++ project/.github/Feature_request.md | 17 ++++++++++ project/.github/ISSUE_TEMPLATE.md | 43 ------------------------ project/.github/PULL_REQUEST_TEMPLATE.md | 10 ------ project/.github/Security_issue.md | 16 +++++++++ project/.github/Support_question.md | 16 +++++++++ 8 files changed, 91 insertions(+), 54 deletions(-) create mode 100644 project/.github/Bug_report.md create mode 100644 project/.github/Documentation_issue.md create mode 100644 project/.github/Feature_request.md delete mode 100644 project/.github/ISSUE_TEMPLATE.md delete mode 100644 project/.github/PULL_REQUEST_TEMPLATE.md create mode 100644 project/.github/Security_issue.md create mode 100644 project/.github/Support_question.md diff --git a/config/projects.yml b/config/projects.yml index f05ceed70..b39e80efc 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -106,7 +106,7 @@ routing: when building Symfony full stack applications. branches: master: - minimum_stability: alpha + minimum_stability: dev docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] diff --git a/project/.github/Bug_report.md b/project/.github/Bug_report.md new file mode 100644 index 000000000..42173b6d4 --- /dev/null +++ b/project/.github/Bug_report.md @@ -0,0 +1,26 @@ +--- +name: Bug Report +about: Report errors and problems + +--- + + + +**Symfony version(s) affected**: x.y.z + +**Description** + + +**How to reproduce** + + +**Possible Solution** + + +**Additional context** + diff --git a/project/.github/Documentation_issue.md b/project/.github/Documentation_issue.md new file mode 100644 index 000000000..eed9470b6 --- /dev/null +++ b/project/.github/Documentation_issue.md @@ -0,0 +1,15 @@ +--- +name: Documentation Issue +about: Anything related to Symfony Documentation + +--- + + + +Symfony Documentation has its own dedicated repository. Please open your +documentation-related issue at https://github.com/symfony/symfony-docs/issues + +Thanks! diff --git a/project/.github/Feature_request.md b/project/.github/Feature_request.md new file mode 100644 index 000000000..3422cc135 --- /dev/null +++ b/project/.github/Feature_request.md @@ -0,0 +1,17 @@ +--- +name: Feature Request +about: RFC and ideas for new features and improvements + +--- + + + +**Description** + + +**Example** + diff --git a/project/.github/ISSUE_TEMPLATE.md b/project/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 25da2b37e..000000000 --- a/project/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,43 +0,0 @@ - - - - -### Environment - -#### Symfony packages - -``` -$ composer show --latest 'symfony/*' -``` - -#### Symfony CMF packages - -``` -$ composer show --latest 'symfony-cmf/*' -``` - -## Subject - - - -## Steps to reproduce - -## Expected results - -## Actual results - - diff --git a/project/.github/PULL_REQUEST_TEMPLATE.md b/project/.github/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index 0d8f7f77b..000000000 --- a/project/.github/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,10 +0,0 @@ -| Q | A -| ------------- | --- -| Branch? | "master" for new features / the branch of the current release for fixes -| Bug fix? | yes/no -| New feature? | yes/no -| BC breaks? | yes/no -| Deprecations? | yes/no -| Fixed tickets | comma-separated list of tickets fixed by the PR, if any -| License | MIT -| Doc PR | reference to the documentation PR, if any diff --git a/project/.github/Security_issue.md b/project/.github/Security_issue.md new file mode 100644 index 000000000..29981939d --- /dev/null +++ b/project/.github/Security_issue.md @@ -0,0 +1,16 @@ +--- +name: Security Issue +about: Report security-related errors + +--- + + + +If you have found a security issue in Symfony, please send the details to +security [at] symfony.com and don't disclose it publicly until we can provide a +fix for it. + +More information: https://symfony.com/security diff --git a/project/.github/Support_question.md b/project/.github/Support_question.md new file mode 100644 index 000000000..40a927703 --- /dev/null +++ b/project/.github/Support_question.md @@ -0,0 +1,16 @@ +--- +name: Support Question +about: Questions about using Symfony and its components + +--- + + + +We use GitHub issues only to discuss about Symfony bugs and new features. For +this kind of questions about using Symfony or third-party bundles, please use +any of the support alternatives shown in https://symfony.com/support + +Thanks! From 12502d15bdf698ca393df18891b1b56feb64c102 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Wed, 13 Jun 2018 23:18:55 +0200 Subject: [PATCH 33/39] changes for github templates and add possibility to get unlimited memory --- config/projects.yml | 1 + project/.github/Bug_report.md | 2 -- project/.github/Documentation_issue.md | 11 +++-------- project/.github/Feature_request.md | 5 ----- project/.github/Security_issue.md | 9 +-------- project/.github/Support_question.md | 17 ++++++++--------- project/.travis.yml.twig | 9 ++++++++- project/travis.php.ini | 1 + src/Config/ProjectsConfiguration.php | 1 + src/Console/Command/DispatchCommand.php | 8 ++++++-- 10 files changed, 29 insertions(+), 35 deletions(-) create mode 100644 project/travis.php.ini diff --git a/config/projects.yml b/config/projects.yml index b39e80efc..84ebb02e1 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -43,6 +43,7 @@ block-bundle: provides a few commonly used standard blocks, including the ability to edit them. branches: master: + unlimited_memory: true minimum_stability: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel diff --git a/project/.github/Bug_report.md b/project/.github/Bug_report.md index 42173b6d4..8b27ed79e 100644 --- a/project/.github/Bug_report.md +++ b/project/.github/Bug_report.md @@ -9,8 +9,6 @@ about: Report errors and problems See https://symfony.com/doc/current/contributing/code_of_conduct/index.html --> -**Symfony version(s) affected**: x.y.z - **Description** diff --git a/project/.github/Documentation_issue.md b/project/.github/Documentation_issue.md index eed9470b6..196478c4b 100644 --- a/project/.github/Documentation_issue.md +++ b/project/.github/Documentation_issue.md @@ -1,15 +1,10 @@ --- name: Documentation Issue -about: Anything related to Symfony Documentation +about: Anything related to Symfony CMF Documentation --- - - -Symfony Documentation has its own dedicated repository. Please open your -documentation-related issue at https://github.com/symfony/symfony-docs/issues +Symfony CMF Documentation has its own dedicated repository. Please open your +documentation-related issue at https://github.com/symfony-cmf/symfony-cmf-docs/issues Thanks! diff --git a/project/.github/Feature_request.md b/project/.github/Feature_request.md index 3422cc135..db3e02ca9 100644 --- a/project/.github/Feature_request.md +++ b/project/.github/Feature_request.md @@ -4,11 +4,6 @@ about: RFC and ideas for new features and improvements --- - - **Description** diff --git a/project/.github/Security_issue.md b/project/.github/Security_issue.md index 29981939d..34be6e0e3 100644 --- a/project/.github/Security_issue.md +++ b/project/.github/Security_issue.md @@ -4,13 +4,6 @@ about: Report security-related errors --- - - If you have found a security issue in Symfony, please send the details to -security [at] symfony.com and don't disclose it publicly until we can provide a +[David](mailto:david@liip.ch) or [Maximilian](mailto:maximilian.berghoff@gmx.de) and don't disclose it publicly until we can provide a fix for it. - -More information: https://symfony.com/security diff --git a/project/.github/Support_question.md b/project/.github/Support_question.md index 40a927703..c128b566f 100644 --- a/project/.github/Support_question.md +++ b/project/.github/Support_question.md @@ -1,16 +1,15 @@ --- name: Support Question -about: Questions about using Symfony and its components +about: Questions about using Symfony CMF and its components --- - +**Description** + -We use GitHub issues only to discuss about Symfony bugs and new features. For -this kind of questions about using Symfony or third-party bundles, please use -any of the support alternatives shown in https://symfony.com/support +**How to reproduce (optional)** + + +**Possible Solution** + -Thanks! diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index c3b4251e7..30028b638 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -81,12 +81,19 @@ matrix: before_install: - phpenv config-rm xdebug.ini || true - composer self-update + - composer validate --no-check-all --ansi - if ! [ -z "$STABILITY" ]; then composer config minimum-stability ${STABILITY}; composer config prefer-stable true; fi; - if [ "$SYMFONY_VERSION" != "" ]; then composer require symfony/symfony:${SYMFONY_VERSION} --no-update; fi - export BRANCH=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then echo $TRAVIS_BRANCH; else echo $TRAVIS_PULL_REQUEST_BRANCH; fi) +{% if unlimited_memory %} +install: + - phpenv config-add travis.php.ini + - php -ini | grep memory_limit + - travis_wait composer update --prefer-dist $COMPOSER_FLAGS +{% else %} install: travis_wait composer update --prefer-dist $COMPOSER_FLAGS - +{% endif %} script: - if [ "${TEST_INSTALLATION}" == true ]; then make test_installation; else make test; fi diff --git a/project/travis.php.ini b/project/travis.php.ini new file mode 100644 index 000000000..7999e9615 --- /dev/null +++ b/project/travis.php.ini @@ -0,0 +1 @@ +memory_limit = -1 diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index d2cbab8eb..8b3c30163 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -56,6 +56,7 @@ public function getConfigTreeBuilder() ->defaultValue([]) ->prototype('array') ->children() + ->booleanNode('unlimited_memory')->defaultFalse()->end() ->scalarNode('minimum_stability')->defaultValue('prod')->end() ->arrayNode('php')->prototype('scalar')->defaultValue([])->end()->end() ->arrayNode('services')->prototype('scalar')->defaultValue([])->end()->end() diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index 39541aed7..acfd9c445 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -465,11 +465,15 @@ private function renderFile( if (in_array(substr($localPath, 8), $projectConfig['excluded_files'], true)) { return; } - + $notRendered = ['.', '..']; + $branchConfig = $projectConfig['branches'][$branchName]; + if (!isset($branchConfig['unlimited_memory']) || !$branchConfig['unlimited_memory']) { + $notRendered[] = 'travis.php.ini'; + } if ('dir' === $localFileType) { $localDirectory = dir($localFullPath); while (false !== ($entry = $localDirectory->read())) { - if (!in_array($entry, ['.', '..'], true)) { + if (!in_array($entry, $notRendered, true)) { $this->renderFile( $package, $repositoryName, From 3eb0bc9f0e47129dc9bf3da1cabf548f1a27cf7d Mon Sep 17 00:00:00 2001 From: "Andrey F. Mindubaev" Date: Sat, 30 Jun 2018 19:56:18 +0300 Subject: [PATCH 34/39] Get support for PHP 5.6 and PHP 7.0 back --- config/projects.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/projects.yml b/config/projects.yml index 84ebb02e1..46e8ba5b3 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -264,7 +264,7 @@ testing: minimum_stability: dev docs_path: 'components/testing' deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + php: ['5.6','7.0','7.1', '7.2'] make_tasks: unit_tests: ~ versions: From abe4b1bce2a87ea24309b7744289a815d9c8b290 Mon Sep 17 00:00:00 2001 From: "Andrey F. Mindubaev" Date: Sat, 30 Jun 2018 19:58:52 +0300 Subject: [PATCH 35/39] Always require stable packages for job with "--prefer-lowest" composer flag --- project/.travis.yml.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 30028b638..197c8bcb8 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -51,7 +51,7 @@ matrix: - php: {{ php|last }} env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} From 43e91e41dffc85d02670e5577267cdfda8e237bb Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sat, 11 Aug 2018 05:52:20 +0200 Subject: [PATCH 36/39] prepared release for core- and seo-bundle --- config/projects.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index 46e8ba5b3..d827383e2 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -4,7 +4,6 @@ seo-bundle: aware for Search Engine Optimisation (SEO). branches: master: - minimum_stability: dev docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' deprecation_warnings: "/.*each.*/" @@ -23,7 +22,6 @@ core-bundle: a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. branches: master: - minimum_stability: dev docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel deprecation_warnings: "/.*each.*/" From 437ab8e990b5522a6c5af662a0c08a7c8c6e9cff Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Sun, 7 Oct 2018 04:13:28 +0200 Subject: [PATCH 37/39] changes due to next version step on seo-bundle --- config/projects.yml | 23 ++++++++++++----------- project/.travis.yml.twig | 6 +++--- 2 files changed, 15 insertions(+), 14 deletions(-) diff --git a/config/projects.yml b/config/projects.yml index d827383e2..498a72d0f 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -15,6 +15,18 @@ seo-bundle: test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + 2.1: + docs_path: 'bundles/seo' + test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' + deprecation_warnings: "/.*each.*/" + php: ['7.1', '7.2'] + make_tasks: + unit_tests: ~ + functional_tests_phpcr: ~ + functional_tests_orm: ~ + test_installation: ~ + versions: + symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -42,7 +54,6 @@ block-bundle: branches: master: unlimited_memory: true - minimum_stability: dev docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel deprecation_warnings: "/.*each.*/" @@ -58,7 +69,6 @@ menu-bundle: The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: - minimum_stability: dev docs_path: 'bundles/menu' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel @@ -77,7 +87,6 @@ routing-bundle: controller for redirection routes. branches: master: - minimum_stability: dev docs_path: 'bundles/routing' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel @@ -105,7 +114,6 @@ routing: when building Symfony full stack applications. branches: master: - minimum_stability: dev docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -119,7 +127,6 @@ routing-auto: This library contains all implementation agnostic code. branches: master: - minimum_stability: dev docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -132,7 +139,6 @@ content-bundle: The ContentBundle provides a document for static content and the controller to render it. branches: master: - minimum_stability: dev docs_path: 'bundles/routing' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel @@ -148,7 +154,6 @@ routing-auto-bundle: This bundle automatically creates and manages routes for configured persisted document classes. branches: master: - minimum_stability: dev docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel deprecation_warnings: "/.*each.*/" @@ -176,7 +181,6 @@ resource-rest-bundle: branches: master: - minimum_stability: dev docs_path: 'bundles/resource-rest' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel @@ -208,7 +212,6 @@ resource-bundle: branches: master: - minimum_stability: dev docs_path: 'bundles/resource-rest' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel @@ -246,7 +249,6 @@ resource: branches: master: - minimum_stability: dev docs_path: 'components/resource' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -275,7 +277,6 @@ tree-browser-bundle: branches: master: - minimum_stability: dev docs_path: 'bundle/tree-browser-bundle' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 197c8bcb8..9eb002f8e 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -49,19 +49,19 @@ matrix: env: STABILITY={{ minimum_stability }} SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} {% endif %} - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ versions.symfony|last }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ versions.symfony|last }} - php: {{ php|first }} env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ version }} {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - php: {{ php_version }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }}{% endif %} SYMFONY_VERSION={{ version }} + env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ version }} {% endfor %} {% endfor %} {% endif %} From 45f606c1078ab35602775dcdf493d0f8e13aa29a Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 11 Dec 2018 09:52:16 +0100 Subject: [PATCH 38/39] current project situation --- composer.json | 3 +- config/projects.yml | 39 ++++++++----------- project/README.md.twig | 13 ++++++- src/Config/ProjectsConfiguration.php | 1 + src/Console/Command/AbstractCommand.php | 27 +++++++++++++ src/Console/Command/DispatchCommand.php | 52 ++++++++++++++++++++----- 6 files changed, 100 insertions(+), 35 deletions(-) diff --git a/composer.json b/composer.json index 7bf863999..f3908c061 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "symfony/console": "^3.0", "symfony/filesystem": "^3.0", "twig/twig": "^1.24", - "vlucas/phpdotenv": "^2.2" + "vlucas/phpdotenv": "^2.2", + "composer/semver": "^1.4" }, "require-dev": { "symfony/var-dumper": "^3.0" diff --git a/config/projects.yml b/config/projects.yml index 498a72d0f..ecccea3e0 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -4,6 +4,7 @@ seo-bundle: aware for Search Engine Optimisation (SEO). branches: master: + target_branch: 2.x docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' deprecation_warnings: "/.*each.*/" @@ -12,19 +13,6 @@ seo-bundle: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ - test_installation: ~ - versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] - 2.1: - docs_path: 'bundles/seo' - test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] - make_tasks: - unit_tests: ~ - functional_tests_phpcr: ~ - functional_tests_orm: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] core-bundle: @@ -34,6 +22,7 @@ core-bundle: a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. branches: master: + target_branch: 2.x docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel deprecation_warnings: "/.*each.*/" @@ -41,7 +30,6 @@ core-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] block-bundle: @@ -53,6 +41,7 @@ block-bundle: provides a few commonly used standard blocks, including the ability to edit them. branches: master: + target_branch: 2.x unlimited_memory: true docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel @@ -61,7 +50,6 @@ block-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] menu-bundle: @@ -69,6 +57,7 @@ menu-bundle: The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: + target_branch: 2.x docs_path: 'bundles/menu' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel @@ -76,7 +65,6 @@ menu-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] routing-bundle: @@ -87,6 +75,7 @@ routing-bundle: controller for redirection routes. branches: master: + target_branch: 2.x docs_path: 'bundles/routing' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel @@ -95,9 +84,9 @@ routing-bundle: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + routing: description: | The Symfony CMF Routing component extends the Symfony routing component with additional features: @@ -114,6 +103,7 @@ routing: when building Symfony full stack applications. branches: master: + target_branch: 2.x docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -127,6 +117,7 @@ routing-auto: This library contains all implementation agnostic code. branches: master: + target_branch: 2.x docs_path: 'components/routing' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -139,6 +130,7 @@ content-bundle: The ContentBundle provides a document for static content and the controller to render it. branches: master: + target_branch: 2.x docs_path: 'bundles/routing' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel @@ -146,7 +138,6 @@ content-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] routing-auto-bundle: @@ -154,6 +145,7 @@ routing-auto-bundle: This bundle automatically creates and manages routes for configured persisted document classes. branches: master: + target_branch: 1.x docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel deprecation_warnings: "/.*each.*/" @@ -161,7 +153,6 @@ routing-auto-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] resource-rest-bundle: @@ -181,13 +172,13 @@ resource-rest-bundle: branches: master: + target_branch: 1.0 docs_path: 'bundles/resource-rest' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel php: ['7.1', '7.2'] make_tasks: unit_tests: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] resource-bundle: @@ -212,6 +203,7 @@ resource-bundle: branches: master: + target_branch: 1.0 docs_path: 'bundles/resource-rest' deprecation_warnings: "/.*each.*/" test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel @@ -219,13 +211,13 @@ resource-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] sonata-phpcr-admin-integration-bundle: description: "" branches: master: + target_branch: 1.x minimum_stability: dev docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' test_kernel: Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel @@ -234,7 +226,6 @@ sonata-phpcr-admin-integration-bundle: make_tasks: unit_tests: ~ functional_tests_phpcr: ~ - test_installation: ~ versions: symfony: ['2.8.*','3.3.*', '3.4.*', '4.0.*'] resource: @@ -249,6 +240,7 @@ resource: branches: master: + target_branch: 1.0 docs_path: 'components/resource' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] @@ -261,6 +253,7 @@ testing: branches: master: + target_branch: 2.x minimum_stability: dev docs_path: 'components/testing' deprecation_warnings: "/.*each.*/" @@ -277,11 +270,11 @@ tree-browser-bundle: branches: master: + target_branch: 2.x docs_path: 'bundle/tree-browser-bundle' deprecation_warnings: "/.*each.*/" php: ['7.1', '7.2'] make_tasks: unit_tests: ~ - test_installation: ~ versions: symfony: ['2.8.*', '3.3', '3.4.*', '4.0.*'] \ No newline at end of file diff --git a/project/README.md.twig b/project/README.md.twig index b375207d3..d5b8eb0bb 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -8,13 +8,13 @@ [![Monthly Downloads](https://poser.pugx.org/{{ packagist_name }}/d/monthly)](https://packagist.org/packages/{{ packagist_name }}) [![Daily Downloads](https://poser.pugx.org/{{ packagist_name }}/d/daily)](https://packagist.org/packages/{{ packagist_name }}) -Branch | Travis | Coveralls | +Version/Branch | Travis | Coveralls | ------ | ------ | --------- | {% if legacy_branch != stable_branch %} {{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | {% endif %} {% if unstable_branch != stable_branch %} -{{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | +{{ stable_version }} | [![Build Status][travis_stable_badge]][travis_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | {% endif %} {{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | @@ -63,14 +63,23 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). +{% if legacy_branch != stable_branch %} [travis_legacy_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ legacy_branch }} +{% endif %} +{% if unstable_branch != stable_branch %} [travis_stable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ stable_branch }} +{% endif %} [travis_unstable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ unstable_branch }} + [travis_link]: https://travis-ci.org/{{ packagist_name }} +{% if legacy_branch != stable_branch %} [coveralls_legacy_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ legacy_branch }} [coveralls_legacy_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ legacy_branch }} +{% endif %} +{% if unstable_branch != stable_branch %} [coveralls_stable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ stable_branch }} [coveralls_stable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ stable_branch }} +{% endif %} [coveralls_unstable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ unstable_branch }} [coveralls_unstable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ unstable_branch }} diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index 8b3c30163..cd8951aa0 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -56,6 +56,7 @@ public function getConfigTreeBuilder() ->defaultValue([]) ->prototype('array') ->children() + ->scalarNode('target_branch')->defaultValue('master')->end() ->booleanNode('unlimited_memory')->defaultFalse()->end() ->scalarNode('minimum_stability')->defaultValue('prod')->end() ->arrayNode('php')->prototype('scalar')->defaultValue([])->end()->end() diff --git a/src/Console/Command/AbstractCommand.php b/src/Console/Command/AbstractCommand.php index ae22e49e3..0275b30f0 100644 --- a/src/Console/Command/AbstractCommand.php +++ b/src/Console/Command/AbstractCommand.php @@ -22,6 +22,8 @@ use Symfony\Component\Console\Output\OutputInterface; use Symfony\Component\Console\Style\SymfonyStyle; use Symfony\Component\Yaml\Yaml; +use Composer\Semver; +use Packagist\Api\Result\Package\Version; /** * @author Sullivan Senechal @@ -116,4 +118,29 @@ final protected function getRepositoryName(Package $package) return str_replace('.git', '', end($repositoryArray)); } + + /** + * @param Packaage $package + * + * @return [] + */ + final protected function getStableVersions(Package $package): array + { + $stableVersions = array_filter( + array_keys($package->getVersions()), + function ($version) { + try { + if ('stable' !== Semver\VersionParser::parseStability($version)) { + return false; + } + } catch (\Exception $e) { + return false; + } + + return true; + } + ); + + return Semver\Semver::rsort($stableVersions); + } } diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index acfd9c445..ca786bdf0 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -93,6 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } } catch (ExceptionInterface $e) { $this->io->error('Failed with message: ' . $e->getMessage()); + $this->io->writeln($e->getTraceAsString(), OutputInterface::VERBOSITY_DEBUG); } } @@ -299,7 +300,17 @@ private function updateBranchesProtection(Package $package, array $projectConfig if (!$this->apply) { return; } + foreach ($branches as $branch) { + $this->updateBranch($branch, $repositoryName); + if (isset($projectConfig['branches'][$branch]['target_branch'])) { + $this->updateBranch($projectConfig['branches'][$branch]['target_branch'], $repositoryName); + } + } + } + + private function updateBranch($branch, $repositoryName) + { $protectionConfig = [ 'required_status_checks' => [ 'strict' => false, @@ -319,11 +330,11 @@ private function updateBranchesProtection(Package $package, array $projectConfig 'restrictions' => null, 'enforce_admins' => false, ]; - foreach ($branches as $branch) { - $this->githubClient->repo()->protection() - ->update($this->githubGroup, $repositoryName, $branch, $protectionConfig); - } - $this->io->comment('Branches protection applied.'); + + $this->githubClient->repo()->protection() + ->update($this->githubGroup, $repositoryName, $branch, $protectionConfig); + + $this->io->comment('Branches protection applied to branch '.$branch); } /** @@ -497,8 +508,10 @@ private function renderFile( $branchConfig = $projectConfig['branches'][$branchName]; $localPathInfo = pathinfo($localPath); reset($projectConfig['branches']); + $stableVersions = $this->getStableVersions($package); + $latestStableVersion = array_shift($stableVersions); $unstableBranch = key($projectConfig['branches']); - $stableBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $unstableBranch; + $stableBranch = $branchConfig['target_branch'] ?: $unstableBranch; $legacyBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $stableBranch; if (array_key_exists('extension', $localPathInfo) && 'twig' === $localPathInfo['extension']) { $distPath = dirname($distPath) . '/' . basename($distPath, '.twig'); @@ -507,14 +520,19 @@ private function renderFile( $projectConfig, $branchConfig, [ - 'package_title' => Inflector::ucwords(str_replace(['cmf', '/', '-'], ['CMF', ' ', ' '], $package->getName())), + 'package_title' => Inflector::ucwords( + str_replace(['cmf', '/', '-'], + ['CMF', ' ', ' '], + $package->getName()) + ), 'package_description' => $package->getDescription(), 'packagist_name' => $package->getName(), 'package_name' => $package->getName(), 'repository_name' => $repositoryName, 'current_branch' => $branchName, 'unstable_branch' => $unstableBranch, - 'stable_branch' => $stableBranch, + 'stable_version' => $latestStableVersion, + 'stable_branch' => $branchConfig['target_branch'], 'legacy_branch' => $legacyBranch, ] ))); @@ -526,6 +544,7 @@ private function renderFile( '{{ repository_name }}', '{{ current_branch }}', '{{ unstable_branch }}', + '{{ stable_version }}', '{{ stable_branch }}', '{{ legacy_branch }}', '{{ docs_path }}', @@ -537,7 +556,8 @@ private function renderFile( $repositoryName, $branchName, $unstableBranch, - $stableBranch, + $latestStableVersion, + $branchConfig['target_branch'], $legacyBranch, $branchConfig['docs_path'], str_replace([$this->packagistGroup . '/', '-bundle'], '', $package->getName()), @@ -548,6 +568,9 @@ private function renderFile( } /** + * Takes care on correct version in own packages and in symfony packiges. + * Also sets the target version in composer.json file. + * * @param string $path * @param array $projectConfig * @@ -607,6 +630,17 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c if (preg_match('/bundle/', $composerAsJson['name'])) { $composerAsJson['type'] = 'symfony-bundle'; } + + // takes care on correct target branch for master + $targetMasterBranch = $branchConfig['target_branch'].'-dev'; + if (!isset($composerAsJson['extra'])) { + $composerAsJson['extra'] = ['branch-alias' => ['dev-master' => $targetMasterBranch]]; + } elseif (!isset($composerAsJson['extra']['branch-alias'])) { + $composerAsJson['extra'][branch-alias] = ['dev-master' => $targetMasterBranch]; + } elseif (!isset($composerAsJson['extra']['branch-alias']['dev-master'])) { + $composerAsJson['extra']['branch-alias']['dev-master'] = $targetMasterBranch; + } + $composerAsString = json_encode($composerAsJson, JSON_PRETTY_PRINT); $composerAsString = str_replace('\/', '/', $composerAsString); $composerAsString .= PHP_EOL; From a2cdbea8b66ceb6b0cab7e4d2aad0d8c033aef01 Mon Sep 17 00:00:00 2001 From: ElectricMaxxx Date: Tue, 29 Jan 2019 07:00:30 +0100 Subject: [PATCH 39/39] move almost all packages onto next major version --- config/dev-kit.yml | 1 - config/projects.yml | 164 +++++++++------ project/.travis.yml.twig | 32 ++- project/README.md.twig | 62 +++--- src/Config/ProjectsConfiguration.php | 4 +- src/Console/Command/DispatchCommand.php | 261 +++++++++++++----------- 6 files changed, 288 insertions(+), 236 deletions(-) diff --git a/config/dev-kit.yml b/config/dev-kit.yml index dbdf08154..d400e6d86 100644 --- a/config/dev-kit.yml +++ b/config/dev-kit.yml @@ -38,7 +38,6 @@ labels: color: '5319e7' - name: 'UX' color: '19E791' - color: '333333' - name: 'discussion' color: 'cc317c' - name: 'enhancement' diff --git a/config/projects.yml b/config/projects.yml index ecccea3e0..3904249de 100644 --- a/config/projects.yml +++ b/config/projects.yml @@ -4,17 +4,18 @@ seo-bundle: aware for Search Engine Optimisation (SEO). branches: master: - target_branch: 2.x + next_unstable: '3.0' + phpunit_version: "5.7.26" docs_path: 'bundles/seo' test_kernel: 'Symfony\Cmf\Bundle\SeoBundle\Tests\Fixtures\App\Kernel' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] core-bundle: description: | The CoreBundle for the Symfony content management framework provides common functionality, @@ -22,16 +23,18 @@ core-bundle: a twig extension and php templating helper to walk PHPCR-ODM trees and support for optional translated content. branches: master: - target_branch: 2.x + next_unstable: '3.0' + target_branch: "2.1" + phpunit_version: "5.7.26" docs_path: 'bundles/core' test_kernel: Symfony\Cmf\Bundle\CoreBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] block-bundle: description: | The BlockBundle provides integration with @@ -41,32 +44,37 @@ block-bundle: provides a few commonly used standard blocks, including the ability to edit them. branches: master: - target_branch: 2.x + next_unstable: '3.0' + phpunit_version: "5.7.26" + target_branch: "2.1" unlimited_memory: true docs_path: 'bundles/block' test_kernel: Symfony\Cmf\Bundle\BlockBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] + menu-bundle: description: | The MenuBundle provides menus from a doctrine object manager with the help of KnpMenuBundle. branches: master: - target_branch: 2.x + next_unstable: '3.0' + phpunit_version: "5.7.26" + target_branch: "2.2" docs_path: 'bundles/menu' - deprecation_warnings: "/.*each.*/" + deprecation_warnings: "weak" test_kernel: Symfony\Cmf\Bundle\MenuBundle\Tests\Fixtures\App\Kernel - php: ['7.1', '7.2'] + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] routing-bundle: description: | The RoutingBundle enables the @@ -75,17 +83,21 @@ routing-bundle: controller for redirection routes. branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundles/routing' - deprecation_warnings: "/.*each.*/" + deprecation_warnings: "weak" test_kernel: Symfony\Cmf\Bundle\RoutingBundle\Tests\Fixtures\App\Kernel - php: ['7.1', '7.2'] + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ functional_tests_orm: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] routing: description: | @@ -103,58 +115,74 @@ routing: when building Symfony full stack applications. branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'components/routing' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*',] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] routing-auto: description: | This component automatically creates and manages routes for configured persisted document classes. This library contains all implementation agnostic code. branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'components/routing' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: [ '3.4.*', '4.0.*', '4.1.*', '4.2.*'] content-bundle: description: | The ContentBundle provides a document for static content and the controller to render it. branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundles/routing' - deprecation_warnings: "/.*each.*/" + deprecation_warnings: "weak" test_kernel: Symfony\Cmf\Bundle\ContentBundle\Tests\Fixtures\App\Kernel - php: ['7.1', '7.2'] + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] routing-auto-bundle: description: | This bundle automatically creates and manages routes for configured persisted document classes. branches: master: - target_branch: 1.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundles/routing-auto-bundle' test_kernel: Symfony\Cmf\Bundle\RoutingAutoBundle\Tests\Fixtures\App\Kernel - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] resource-rest-bundle: description: | This Bundle provides a REST API to Puli resources as provided by the CmfResource component. @@ -172,15 +200,19 @@ resource-rest-bundle: branches: master: - target_branch: 1.0 + next_unstable: '2.0' + last_stable: "1.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundles/resource-rest' - deprecation_warnings: "/.*each.*/" + deprecation_warnings: "weak" test_kernel: Symfony\Cmf\Bundle\ResourceRestBundle\Tests\Fixtures\App\Kernel - php: ['7.1', '7.2'] + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] resource-bundle: description: | This bundle provides *object* resource location services based on Puli. @@ -203,21 +235,28 @@ resource-bundle: branches: master: - target_branch: 1.0 + next_unstable: '2.0' + last_stable: "1.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundles/resource-rest' - deprecation_warnings: "/.*each.*/" + deprecation_warnings: "weak" test_kernel: Symfony\Cmf\Bundle\ResourceBundle\Tests\Fixtures\App\Kernel - php: ['7.1', '7.2'] + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] sonata-phpcr-admin-integration-bundle: description: "" branches: master: - target_branch: 1.x + next_unstable: '2.0' + last_stable: "1.1" + target_branch: "master" + phpunit_version: "5.7.26" minimum_stability: dev docs_path: 'bundles/sonata-phpcr-admin-integration-bundle' test_kernel: Symfony\Cmf\Bundle\SonataPhpcrAdminIntegrationBundle\Tests\Fixtures\App\Kernel @@ -227,7 +266,7 @@ sonata-phpcr-admin-integration-bundle: unit_tests: ~ functional_tests_phpcr: ~ versions: - symfony: ['2.8.*','3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] resource: excluded_files: - .travis.yml.twig @@ -240,10 +279,14 @@ resource: branches: master: - target_branch: 1.0 + next_unstable: '3.0' + last_stable: "1.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'components/resource' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ testing: @@ -253,15 +296,18 @@ testing: branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" minimum_stability: dev docs_path: 'components/testing' - deprecation_warnings: "/.*each.*/" - php: ['5.6','7.0','7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3.*', '3.4.*', '4.0.*'] + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] tree-browser-bundle: excluded_files: - .travis.yml.twig @@ -270,11 +316,15 @@ tree-browser-bundle: branches: master: - target_branch: 2.x + next_unstable: '3.0' + last_stable: "2.1" + target_branch: "master" + phpunit_version: "5.7.26" + minimum_stability: dev docs_path: 'bundle/tree-browser-bundle' - deprecation_warnings: "/.*each.*/" - php: ['7.1', '7.2'] + deprecation_warnings: "weak" + php: ['7.2', '7.3'] make_tasks: unit_tests: ~ versions: - symfony: ['2.8.*', '3.3', '3.4.*', '4.0.*'] \ No newline at end of file + symfony: ['3.4.*', '4.0.*', '4.1.*', '4.2.*'] \ No newline at end of file diff --git a/project/.travis.yml.twig b/project/.travis.yml.twig index 9eb002f8e..09890ba40 100644 --- a/project/.travis.yml.twig +++ b/project/.travis.yml.twig @@ -40,42 +40,36 @@ env: {% if phpunit_version %} - SYMFONY_PHPUNIT_VERSION={{ phpunit_version }} {% endif %} - - TEST_INSTALLATION=false matrix: include: {% if failing_allowed_versions.symfony is defined %} - - php: {{ php|last }} - env: STABILITY={{ minimum_stability }} SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} + - php: "{{ php|last }}" + env: STABILITY="{{ minimum_stability }}" SYMFONY_VERSION="{{ failing_allowed_versions.symfony|first }}" {% endif %} - - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ versions.symfony|last }} - - php: {{ php|first }} - env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION={{ versions.symfony|first }} SYMFONY_DEPRECATIONS_HELPER=weak + - php: "{{ php|last }}" + env: {% if minimum_stability != 'prod' %}STABILITY="{{ minimum_stability }}" {% endif %}SYMFONY_VERSION="{{ versions.symfony|last }}" + - php: "{{ php|first }}" + env: COMPOSER_FLAGS="--prefer-lowest" SYMFONY_VERSION="{{ versions.symfony|first }}" SYMFONY_DEPRECATIONS_HELPER={% if deprecation_warnings is defined %}"{{ deprecation_warnings }}"{% else %}"weak"{% endif %} + {% if php|length < 3 %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - - php: {{ php|last }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ version }} + - php: "{{ php|last }}" + env: {% if minimum_stability != 'prod' %}STABILITY="{{ minimum_stability }}" {% endif %}SYMFONY_VERSION="{{ version }}" {% endfor %} {% else %} {% for php_version in php if php_version != php|last and php_version != php|first %} {% for version in versions.symfony if version != versions.symfony|first and version != versions.symfony|last %} - - php: {{ php_version }} - env: {% if minimum_stability != 'prod' %}STABILITY={{ minimum_stability }} {% endif %}SYMFONY_VERSION={{ version }} + - php: "{{ php_version }}" + env: {% if minimum_stability != 'prod' %}STABILITY="{{ minimum_stability }}" {% endif %}SYMFONY_VERSION="{{ version }}" {% endfor %} {% endfor %} -{% endif %} -{% if make_tasks.test_installation is defined %} - - env: TEST_INSTALLATION=true {% endif %} fast_finish: true allow_failures: {% if failing_allowed_versions.symfony is defined %} - - php: {{ php|last }} - env: STABILITY=dev SYMFONY_VERSION={{ failing_allowed_versions.symfony|first }} -{% endif %} -{% if make_tasks.test_installation is defined %} - - env: TEST_INSTALLATION=true + - php: "{{ php|last }}" + env: STABILITY=dev SYMFONY_VERSION="{{ failing_allowed_versions.symfony|first }}" {% endif %} before_install: diff --git a/project/README.md.twig b/project/README.md.twig index d5b8eb0bb..93beec0ae 100644 --- a/project/README.md.twig +++ b/project/README.md.twig @@ -8,17 +8,13 @@ [![Monthly Downloads](https://poser.pugx.org/{{ packagist_name }}/d/monthly)](https://packagist.org/packages/{{ packagist_name }}) [![Daily Downloads](https://poser.pugx.org/{{ packagist_name }}/d/daily)](https://packagist.org/packages/{{ packagist_name }}) -Version/Branch | Travis | Coveralls | ------- | ------ | --------- | -{% if legacy_branch != stable_branch %} -{{ legacy_branch }} | [![Build Status][travis_legacy_badge]][travis_link] | [![Coverage Status][coveralls_legacy_badge]][coveralls_legacy_link] | -{% endif %} -{% if unstable_branch != stable_branch %} -{{ stable_version }} | [![Build Status][travis_stable_badge]][travis_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | -{% endif %} -{{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | - -This package is part of the [Symfony Content Management Framework (CMF)](http://cmf.symfony.com/) and licensed +Branch | Travis | Coveralls | Scrutinizer | +------ | ------ | --------- | ----------- | +{{ stable_branch }} | [![Build Status][travis_stable_badge]][travis_stable_link] | [![Coverage Status][coveralls_stable_badge]][coveralls_stable_link] | [![Scrutinizer Status][scrutinizer_stable_badge]][scrutinizer_stable_link] | +{{ unstable_branch }} | [![Build Status][travis_unstable_badge]][travis_unstable_link] | [![Coverage Status][coveralls_unstable_badge]][coveralls_unstable_link] | [![Scrutinizer Status][scrutinizer_unstable_badge]][scrutinizer_unstable_link] | + + +This package is part of the [Symfony Content Management Framework (CMF)](https://cmf.symfony.com/) and licensed under the [MIT License](LICENSE). {{ description|raw }} @@ -35,16 +31,16 @@ under the [MIT License](LICENSE). For the install guide and reference, see: -* [{{ packagist_name }} Documentation](http://symfony.com/doc/master/cmf/{{ docs_path }}/index.html) +* [{{ packagist_name }} Documentation](https://symfony.com/doc/master/cmf/{{ docs_path }}/index.html) See also: -* [All Symfony CMF documentation](http://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference -* [Symfony CMF Website](http://cmf.symfony.com/) - introduction, live demo, support and community links +* [All Symfony CMF documentation](https://symfony.com/doc/master/cmf/index.html) - complete Symfony CMF reference +* [Symfony CMF Website](https://cmf.symfony.com/) - introduction, live demo, support and community links {{ docs_extra|raw }} ## Support -For general support and questions, please use [StackOverflow](http://stackoverflow.com/questions/tagged/symfony-cmf). +For general support and questions, please use [StackOverflow](https://stackoverflow.com/questions/tagged/symfony-cmf). ## Contributing @@ -53,7 +49,7 @@ Pull requests are welcome. Please see our guide. Unit and/or functional tests exist for this package. See the -[Testing documentation](http://symfony.com/doc/master/cmf/components/testing.html) +[Testing documentation](https://symfony.com/doc/master/cmf/components/testing.html) for a guide to running the tests. Thanks to @@ -63,23 +59,17 @@ Thanks to This package is available under the [MIT license](src/Resources/meta/LICENSE). -{% if legacy_branch != stable_branch %} -[travis_legacy_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ legacy_branch }} -{% endif %} -{% if unstable_branch != stable_branch %} -[travis_stable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ stable_branch }} -{% endif %} -[travis_unstable_badge]: https://travis-ci.org/{{ packagist_name }}.svg?branch={{ unstable_branch }} - -[travis_link]: https://travis-ci.org/{{ packagist_name }} - -{% if legacy_branch != stable_branch %} -[coveralls_legacy_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ legacy_branch }} -[coveralls_legacy_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ legacy_branch }} -{% endif %} -{% if unstable_branch != stable_branch %} -[coveralls_stable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ stable_branch }} -[coveralls_stable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ stable_branch }} -{% endif %} -[coveralls_unstable_badge]: https://coveralls.io/repos/github/{{ packagist_name }}/badge.svg?branch={{ unstable_branch }} -[coveralls_unstable_link]: https://coveralls.io/github/{{ packagist_name }}?branch={{ unstable_branch }} +[travis_stable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ stable_branch }} +[travis_stable_link]: https://travis-ci.org/symfony-cmf/{{ repository_name }} +[travis_unstable_badge]: https://travis-ci.org/symfony-cmf/{{ repository_name }}.svg?branch={{ unstable_branch }} +[travis_unstable_link]: https://travis-ci.org/symfony-cmf/{{ repository_name }} + +[coveralls_stable_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ stable_branch }} +[coveralls_stable_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ stable_branch }} +[coveralls_unstable_badge]: https://coveralls.io/repos/github/symfony-cmf/{{ repository_name }}/badge.svg?branch={{ unstable_branch }} +[coveralls_unstable_link]: https://coveralls.io/github/symfony-cmf/{{ repository_name }}?branch={{ unstable_branch }} + +[scrutinizer_stable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/{{ repository_name }}/badges/quality-score.png?b={{ stable_branch }} +[scrutinizer_stable_link]: https://scrutinizer-ci.com/g/symfony-cmf/{{ repository_name }}/?branch={{ stable_branch }} +[scrutinizer_unstable_badge]: https://scrutinizer-ci.com/g/symfony-cmf/{{ repository_name }}/badges/quality-score.png?b={{ unstable_branch }} +[scrutinizer_unstable_link]: https://scrutinizer-ci.com/g/symfony-cmf/{{ repository_name }}/?branch={{ unstable_branch }} diff --git a/src/Config/ProjectsConfiguration.php b/src/Config/ProjectsConfiguration.php index cd8951aa0..6f61b29d9 100644 --- a/src/Config/ProjectsConfiguration.php +++ b/src/Config/ProjectsConfiguration.php @@ -56,6 +56,8 @@ public function getConfigTreeBuilder() ->defaultValue([]) ->prototype('array') ->children() + ->scalarNode('next_unstable')->defaultValue(null)->end() + ->scalarNode('last_stable')->defaultValue(null)->end() ->scalarNode('target_branch')->defaultValue('master')->end() ->booleanNode('unlimited_memory')->defaultFalse()->end() ->scalarNode('minimum_stability')->defaultValue('prod')->end() @@ -68,7 +70,7 @@ public function getConfigTreeBuilder() ->scalarNode('deprecation_warnings')->defaultValue(24)->end() ->scalarNode('docs_path')->defaultValue('Resources/doc')->end() ->scalarNode('docs_extra')->defaultValue('')->end() - ->scalarNode('phpunit_version')->defaultValue('5.7')->end() + ->scalarNode('phpunit_version')->defaultValue('5.7.26')->end() ->arrayNode('make_tasks') ->prototype('scalar') ->defaultValue([]) diff --git a/src/Console/Command/DispatchCommand.php b/src/Console/Command/DispatchCommand.php index ca786bdf0..8e7910d02 100644 --- a/src/Console/Command/DispatchCommand.php +++ b/src/Console/Command/DispatchCommand.php @@ -18,22 +18,19 @@ final class DispatchCommand extends AbstractNeedApplyCommand { const LABEL_NOTHING_CHANGED = 'Nothing to be changed.'; - + public const PACKAGIST_GROUP = 'symfony-cmf'; /** * @var GitWrapper */ private $gitWrapper; - /** * @var Filesystem */ private $fileSystem; - /** * @var \Twig_Environment */ private $twig; - /** * @var string[] */ @@ -73,7 +70,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { $notConfiguredProjects = array_diff($this->projects, array_keys($this->configs['projects'])); if (count($notConfiguredProjects)) { - $this->io->error('Some specified projects are not configured: '.implode(', ', $notConfiguredProjects)); + $this->io->error('Some specified projects are not configured: ' . implode(', ', $notConfiguredProjects)); return 1; } @@ -129,7 +126,7 @@ private function updateRepositories(Package $package) } if (count($infoToUpdate)) { - $this->io->comment('Following info have to be changed: '.implode(', ', array_keys($infoToUpdate)).'.'); + $this->io->comment('Following info have to be changed: ' . implode(', ', array_keys($infoToUpdate)) . '.'); if ($this->apply) { $this->githubClient->repo()->update( $this->githubGroup, @@ -177,20 +174,28 @@ private function updateLabels(Package $package) } elseif ($shouldBeUpdated) { $state = 'Updated'; if ($this->apply) { - $this->githubClient->repo()->labels()->update($this->githubGroup, $repositoryName, $name, [ - 'name' => $name, - 'color' => $configuredColor, - ]); + $this->githubClient->repo()->labels()->update( + $this->githubGroup, + $repositoryName, + $name, + [ + 'name' => $name, + 'color' => $configuredColor, + ] + ); } } if ($state) { - array_push($rows, [ - $name, - '#' . $color, - $configuredColor ? '#' . $configuredColor : 'N/A', - $state, - ]); + array_push( + $rows, + [ + $name, + '#' . $color, + $configuredColor ? '#' . $configuredColor : 'N/A', + $state, + ] + ); } } @@ -198,17 +203,24 @@ private function updateLabels(Package $package) $color = $label['color']; if ($this->apply) { - $this->githubClient->repo()->labels()->create($this->githubGroup, $repositoryName, [ - 'name' => $name, - 'color' => $color, - ]); + $this->githubClient->repo()->labels()->create( + $this->githubGroup, + $repositoryName, + [ + 'name' => $name, + 'color' => $color, + ] + ); } array_push($rows, [$name, 'N/A', '#' . $color, 'Created']); } - usort($rows, function ($row1, $row2) { - return strcasecmp($row1[0], $row2[0]); - }); + usort( + $rows, + function ($row1, $row2) { + return strcasecmp($row1[0], $row2[0]); + } + ); if (empty($rows)) { $this->io->comment(static::LABEL_NOTHING_CHANGED); @@ -246,8 +258,10 @@ private function updateDevKitHook(Package $package) // First, check if the hook exists. $devKitHook = null; foreach ($this->githubClient->repo()->hooks()->all($this->githubGroup, $repositoryName) as $hook) { - if (array_key_exists('url', $hook['config']) - && 0 === strncmp($hook['config']['url'], $hookBaseUrl, strlen($hookBaseUrl))) { + if ( + array_key_exists('url', $hook['config']) + && 0 === strncmp($hook['config']['url'], $hookBaseUrl, strlen($hookBaseUrl)) + ) { $devKitHook = $hook; break; @@ -258,27 +272,37 @@ private function updateDevKitHook(Package $package) $this->io->comment('Has to be created.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->create($this->githubGroup, $repositoryName, [ - 'name' => 'web', - 'config' => $config, - 'events' => $events, - 'active' => true, - ]); + $this->githubClient->repo()->hooks()->create( + $this->githubGroup, + $repositoryName, + [ + 'name' => 'web', + 'config' => $config, + 'events' => $events, + 'active' => true, + ] + ); $this->io->success('Hook created.'); } - } elseif (count(array_diff_assoc($devKitHook['config'], $config)) + } elseif ( + count(array_diff_assoc($devKitHook['config'], $config)) || count(array_diff($devKitHook['events'], $events)) || !$devKitHook['active'] ) { $this->io->comment('Has to be updated.'); if ($this->apply) { - $this->githubClient->repo()->hooks()->update($this->githubGroup, $repositoryName, $devKitHook['id'], [ - 'name' => 'web', - 'config' => $config, - 'events' => $events, - 'active' => true, - ]); + $this->githubClient->repo()->hooks()->update( + $this->githubGroup, + $repositoryName, + $devKitHook['id'], + [ + 'name' => 'web', + 'config' => $config, + 'events' => $events, + 'active' => true, + ] + ); $this->githubClient->repo()->hooks()->ping($this->githubGroup, $repositoryName, $devKitHook['id']); $this->io->success('Hook updated.'); } @@ -305,8 +329,10 @@ private function updateBranchesProtection(Package $package, array $projectConfig if (isset($projectConfig['branches'][$branch]['target_branch'])) { $this->updateBranch($projectConfig['branches'][$branch]['target_branch'], $repositoryName); } + if (isset($projectConfig['branches'][$branch]['last_stable'])) { + $this->updateBranch($projectConfig['branches'][$branch]['last_stable'], $repositoryName); + } } - } private function updateBranch($branch, $repositoryName) @@ -334,7 +360,7 @@ private function updateBranch($branch, $repositoryName) $this->githubClient->repo()->protection() ->update($this->githubGroup, $repositoryName, $branch, $protectionConfig); - $this->io->comment('Branches protection applied to branch '.$branch); + $this->io->comment('Branches protection applied to branch ' . $branch); } /** @@ -363,16 +389,19 @@ private function dispatchFiles(Package $package) 'https://' . $this->githubUser . ':' . $this->githubAuthKey . '@github.com/' . $this->githubGroup . '/' . $repositoryName, $clonePath ); - $git->config('user.name', $this->githubUser) ->config('user.email', $this->githubEmail); + $git->config('user.name', $this->githubUser)->config('user.email', $this->githubEmail); $branches = array_reverse($projectConfig['branches']); $previousBranch = null; $previousDevKit = null; while (($branchConfig = current($branches))) { // We have to fetch all branches on each step in case a PR is submitted. - $remoteBranches = array_map(function ($branch) { - return $branch['name']; - }, $this->githubClient->repos()->branches($this->githubGroup, $repositoryName)); + $remoteBranches = array_map( + function ($branch) { + return $branch['name']; + }, + $this->githubClient->repos()->branches($this->githubGroup, $repositoryName) + ); $currentBranch = key($branches); $currentDevKit = $currentBranch . '-dev-kit'; @@ -380,16 +409,13 @@ private function dispatchFiles(Package $package) // A PR is already here for previous branch, do nothing on the current one. if (in_array($previousDevKit, $remoteBranches, true)) { - continue; + $this->io->comment('Do not build branch "'.$currentBranch.'" as its previous build "'.$previousDevKit.'" is still there.'); } + // If the previous branch is not merged into the current one, do nothing. - if ($previousBranch && $this->githubClient->repos()->commits()->compare( - $this->githubGroup, - $repositoryName, - $currentBranch, - $previousBranch - )['ahead_by']) { - continue; + $previousIsAhead = ($previousBranch && $this->githubClient->repos()->commits()->compare($this->githubGroup, $repositoryName, $currentBranch, $previousBranch)['ahead_by']); + if ($previousIsAhead) { + $this->io->comment('Do not build branch "'.$currentBranch.'" as its previous branch "'.$previousBranch.'" is not merged into this one.'); } // Diff application @@ -410,9 +436,9 @@ private function dispatchFiles(Package $package) $git->checkout('-b', $currentDevKit); } + $this->setVersionConstraintsInComposer($clonePath, $projectConfig, $currentBranch); $this->renderFile($package, $repositoryName, 'project', $clonePath, $projectConfig, $currentBranch); - $this->setVersionConstraintsInComposer($clonePath, $projectConfig, $currentBranch); $git->add('.', ['all' => true])->getOutput(); $diff = $git->diff('--color', '--cached')->getOutput(); @@ -423,17 +449,25 @@ private function dispatchFiles(Package $package) $git->commit('DevKit updates')->push('-u', 'origin', $currentDevKit); // If the Pull Request does not exists yet, create it. - $pulls = $this->githubClient->pullRequests()->all($this->githubGroup, $repositoryName, [ - 'state' => 'open', - 'head' => $currentDevKit, - ]); - if (0 === count($pulls)) { - $this->githubClient->pullRequests()->create($this->githubGroup, $repositoryName, [ - 'title' => 'DevKit updates for ' . $currentBranch . ' branch', + $pulls = $this->githubClient->pullRequests()->all( + $this->githubGroup, + $repositoryName, + [ + 'state' => 'open', 'head' => $currentDevKit, - 'base' => $currentBranch, - 'body' => '', - ]); + ] + ); + if (0 === count($pulls)) { + $this->githubClient->pullRequests()->create( + $this->githubGroup, + $repositoryName, + [ + 'title' => 'DevKit updates for ' . $currentBranch . ' branch', + 'head' => $currentDevKit, + 'base' => $currentBranch, + 'body' => '', + ] + ); } // Wait 200ms to be sure GitHub API is up to date with new pushed branch/PR. @@ -477,8 +511,9 @@ private function renderFile( return; } $notRendered = ['.', '..']; - $branchConfig = $projectConfig['branches'][$branchName]; - if (!isset($branchConfig['unlimited_memory']) || !$branchConfig['unlimited_memory']) { + $branches = $projectConfig['branches']; + $currentBranchConfig = $branches[$branchName]; + if (!isset($currentBranchConfig['unlimited_memory']) || !$currentBranchConfig['unlimited_memory']) { $notRendered[] = 'travis.php.ini'; } if ('dir' === $localFileType) { @@ -508,60 +543,42 @@ private function renderFile( $branchConfig = $projectConfig['branches'][$branchName]; $localPathInfo = pathinfo($localPath); reset($projectConfig['branches']); - $stableVersions = $this->getStableVersions($package); - $latestStableVersion = array_shift($stableVersions); - $unstableBranch = key($projectConfig['branches']); - $stableBranch = $branchConfig['target_branch'] ?: $unstableBranch; - $legacyBranch = next($projectConfig['branches']) ? key($projectConfig['branches']) : $stableBranch; + $unstableBranch = isset($branchConfig['next_unstable']) ? $branchConfig['next_unstable'].'-dev' : key($projectConfig['branches']); + $stableBranch = isset($branchConfig['last_stable']) ? $branchConfig['last_stable'] : $unstableBranch; + $replacements = array_merge( + $this->configs, + $projectConfig, + $branchConfig, + [ + 'package_title' => Inflector::ucwords( + str_replace( + ['cmf', '/', '-'], + ['CMF', ' ', ' '], + $package->getName() + ) + ), + 'package_description' => $package->getDescription(), + 'packagist_name' => $package->getName(), + 'package_name' => $package->getName(), + 'repository_name' => $repositoryName, + 'current_branch' => $branchName, + 'unstable_branch' => $unstableBranch, + 'stable_branch' => $stableBranch, + 'docs_path' => $branchConfig['docs_path'], + 'tests_path' => str_replace([$this->packagistGroup . '/', '-bundle'], '', $package->getName()), + ] + ); if (array_key_exists('extension', $localPathInfo) && 'twig' === $localPathInfo['extension']) { $distPath = dirname($distPath) . '/' . basename($distPath, '.twig'); - file_put_contents($distPath, $this->twig->render($localPath, array_merge( - $this->configs, - $projectConfig, - $branchConfig, - [ - 'package_title' => Inflector::ucwords( - str_replace(['cmf', '/', '-'], - ['CMF', ' ', ' '], - $package->getName()) - ), - 'package_description' => $package->getDescription(), - 'packagist_name' => $package->getName(), - 'package_name' => $package->getName(), - 'repository_name' => $repositoryName, - 'current_branch' => $branchName, - 'unstable_branch' => $unstableBranch, - 'stable_version' => $latestStableVersion, - 'stable_branch' => $branchConfig['target_branch'], - 'legacy_branch' => $legacyBranch, - ] - ))); + file_put_contents($distPath, $this->twig->render($localPath, $replacements)); } else { - file_put_contents($distPath, str_replace([ - '{{ package_title }}', - '{{ package_description }}', - '{{ packagist_name }}', - '{{ repository_name }}', - '{{ current_branch }}', - '{{ unstable_branch }}', - '{{ stable_version }}', - '{{ stable_branch }}', - '{{ legacy_branch }}', - '{{ docs_path }}', - '{{ website_path }}', - ], [ - Inflector::ucwords(str_replace(['/', '-'], [' ', ' '], $package->getName())), - $package->getDescription(), - $package->getName(), - $repositoryName, - $branchName, - $unstableBranch, - $latestStableVersion, - $branchConfig['target_branch'], - $legacyBranch, - $branchConfig['docs_path'], - str_replace([$this->packagistGroup . '/', '-bundle'], '', $package->getName()), - ], $localContent)); + foreach ($replacements as $key => $value) { + if (is_array($value)) { + continue; + } + $localContent = str_replace('{{ '.$key.' }}', $value, $localContent); + } + file_put_contents($distPath, $localContent); } // Restore file permissions after content copy $this->fileSystem->chmod($distPath, fileperms($localPath)); @@ -578,14 +595,14 @@ private function renderFile( */ private function setVersionConstraintsInComposer($path, array $projectConfig, $currentBranch) { - $filePath = $path.'/composer.json'; + $filePath = $path . '/composer.json'; if (!$this->fileSystem->exists($filePath)) { - throw new \Exception('No composer.json found at: '.$filePath); + throw new \Exception('No composer.json found at: ' . $filePath); } $composerAsString = file_get_contents($filePath); $composerAsJson = json_decode($composerAsString, true); if (!isset($composerAsJson['require'])) { - throw new \Exception('no require path found in composer.json at: '.$filePath); + throw new \Exception('no require path found in composer.json at: ' . $filePath); } $branchConfig = $projectConfig['branches'][$currentBranch]; @@ -601,7 +618,7 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c $this->evaluateVersionString($branchConfig['versions']['symfony']), '^2.8 | ' ); - } elseif (preg_match('/symfony\//', $package) && 'friendsofsymfony/jsrouting-bundle' !== $package) { + } elseif (preg_match('/symfony\//', $package) && 'friendsofsymfony/jsrouting-bundle' !== $package) { $composerAsJson['require'][$package] = $this->evaluateVersionString($branchConfig['versions']['symfony']); } } @@ -632,11 +649,11 @@ private function setVersionConstraintsInComposer($path, array $projectConfig, $c } // takes care on correct target branch for master - $targetMasterBranch = $branchConfig['target_branch'].'-dev'; + $targetMasterBranch = $branchConfig['next_unstable'] . '-dev'; if (!isset($composerAsJson['extra'])) { $composerAsJson['extra'] = ['branch-alias' => ['dev-master' => $targetMasterBranch]]; } elseif (!isset($composerAsJson['extra']['branch-alias'])) { - $composerAsJson['extra'][branch-alias] = ['dev-master' => $targetMasterBranch]; + $composerAsJson['extra'][branch - alias] = ['dev-master' => $targetMasterBranch]; } elseif (!isset($composerAsJson['extra']['branch-alias']['dev-master'])) { $composerAsJson['extra']['branch-alias']['dev-master'] = $targetMasterBranch; }