From 045cf8ebec0dbacfe16d70bb91cdaf9b1039581d Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 14 Dec 2016 17:01:50 +0100 Subject: [PATCH 01/24] Add codeclimate integration --- .codeclimate.yml | 23 +++++++++++++++++++++++ .gitignore | 2 +- .travis.yml | 9 +++++++-- README.md | 5 ++++- RoboFile.php | 2 +- composer.json | 3 ++- 6 files changed, 38 insertions(+), 6 deletions(-) create mode 100644 .codeclimate.yml diff --git a/.codeclimate.yml b/.codeclimate.yml new file mode 100644 index 0000000..8c11231 --- /dev/null +++ b/.codeclimate.yml @@ -0,0 +1,23 @@ +engines: + phpcodesniffer: + enabled: true + config: + standard: "PSR1,PSR2" + phpmd: + enabled: true + duplication: + enabled: true + config: + languages: + php: + fixme: + enabled: true + markdownlint: + enabled: true +ratings: + paths: + - "**.php" + - "**.md" +exclude_paths: +- "**/vendor/**/*" +- "**/.idea/**/*" diff --git a/.gitignore b/.gitignore index 9561ffc..90ab5fd 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ /vendor -/coverage.clover +/build diff --git a/.travis.yml b/.travis.yml index ff76bed..0e8a95b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,11 @@ php: - 5.5 install: - composer self-update - - composer install + - composer install --dev script: - - vendor/bin/robo test + - vendor/bin/robo test:coverage-codeclimate +addons: + code_climate: + repo_token: 0e809aae8958c6e4ad800d73c94551aca9c96d969be0942fc5140a720698acdb +after_success: + - vendor/bin/test-reporter \ No newline at end of file diff --git a/README.md b/README.md index 6837ecd..c912fc8 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,10 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![License](https://poser.pugx.org/digipolisgent/robo-drupal-console/license)](https://packagist.org/packages/digipolisgent/robo-drupal-console) [![Build Status](https://travis-ci.org/digipolisgent/robo-drupal-console.svg?branch=develop)](https://travis-ci.org/digipolisgent/robo-drupal-console) -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9/mini.png)](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9) +[![Code Climate](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/gpa.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console) +[![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console/coverage) [![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/digipolisgent/robo-drupal-console/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/digipolisgent/robo-drupal-console/?branch=develop) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9/mini.png)](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9) [![Dependency Status](https://www.versioneye.com/user/projects/58500a7dfbe933004aa47165/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/58500a7dfbe933004aa47165) Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console commands in stack. You can define global options for all commands (like Drupal root and uri). @@ -33,6 +35,7 @@ Add `"digipolisgent/robo-drupal-console": "~0.1"` to your composer.json: } } ``` + and execute `composer update`. OR diff --git a/RoboFile.php b/RoboFile.php index f47bffc..cdaf8bd 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -24,7 +24,7 @@ public function test() /** * Provides test coverage for Scrutinizer */ - public function testCoverageScrutinize() + public function testCoverageCodeclimate() { $this->stopOnFail(true); $this->taskPHPUnit() diff --git a/composer.json b/composer.json index 7c25340..f9d65c7 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~4.4" + "phpunit/phpunit": "~4.4", + "codeclimate/php-test-reporter": "dev-master" }, "minimum-stability": "RC", "autoload": { From f77118c03798c1c37e85a54cdd6c745f602a383d Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Mon, 19 Dec 2016 16:49:56 +0100 Subject: [PATCH 02/24] Fix composer.lock file --- composer.lock | 386 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 383 insertions(+), 3 deletions(-) diff --git a/composer.lock b/composer.lock index 83f758a..e73f5be 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "41af8d414474c0063ec04fd639b7ab20", - "content-hash": "f4f47596e45fbbdd31974813330d47cf", + "hash": "15818b9661706b90ecbcec91a9472849", + "content-hash": "e95e4059f9441665c1cfa292d68cd9ff", "packages": [ { "name": "alchemy/zippy", @@ -2782,6 +2782,72 @@ } ], "packages-dev": [ + { + "name": "codeclimate/php-test-reporter", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/codeclimate/php-test-reporter.git", + "reference": "0186c8eb03c677b64b9d23dc0cb5c9475553c7c5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/codeclimate/php-test-reporter/zipball/0186c8eb03c677b64b9d23dc0cb5c9475553c7c5", + "reference": "0186c8eb03c677b64b9d23dc0cb5c9475553c7c5", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "padraic/phar-updater": "^1.0", + "php": ">=5.3", + "psr/log": "^1.0", + "satooshi/php-coveralls": "^1.0", + "symfony/console": "^2.0|^3.0" + }, + "require-dev": { + "ext-xdebug": "*", + "phpunit/phpunit": "3.7.*@stable", + "tm/tooly-composer-script": "^1.0" + }, + "bin": [ + "composer/bin/test-reporter" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "0.3.x-dev" + }, + "tools": { + "box": { + "url": "https://github.com/box-project/box2/releases/download/2.7.2/box-2.7.2.phar", + "only-dev": true + } + } + }, + "autoload": { + "psr-4": { + "CodeClimate\\PhpTestReporter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Code Climate", + "email": "hello@codeclimate.com", + "homepage": "https://codeclimate.com" + } + ], + "description": "PHP client for reporting test coverage to Code Climate", + "homepage": "https://github.com/codeclimate/php-test-reporter", + "keywords": [ + "codeclimate", + "coverage" + ], + "time": "2016-09-22 16:57:58" + }, { "name": "doctrine/instantiator", "version": "1.0.5", @@ -2836,6 +2902,211 @@ ], "time": "2015-06-14 21:17:01" }, + { + "name": "guzzle/guzzle", + "version": "v3.9.3", + "source": { + "type": "git", + "url": "https://github.com/guzzle/guzzle3.git", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/guzzle/guzzle3/zipball/0645b70d953bc1c067bbc8d5bc53194706b628d9", + "reference": "0645b70d953bc1c067bbc8d5bc53194706b628d9", + "shasum": "" + }, + "require": { + "ext-curl": "*", + "php": ">=5.3.3", + "symfony/event-dispatcher": "~2.1" + }, + "replace": { + "guzzle/batch": "self.version", + "guzzle/cache": "self.version", + "guzzle/common": "self.version", + "guzzle/http": "self.version", + "guzzle/inflection": "self.version", + "guzzle/iterator": "self.version", + "guzzle/log": "self.version", + "guzzle/parser": "self.version", + "guzzle/plugin": "self.version", + "guzzle/plugin-async": "self.version", + "guzzle/plugin-backoff": "self.version", + "guzzle/plugin-cache": "self.version", + "guzzle/plugin-cookie": "self.version", + "guzzle/plugin-curlauth": "self.version", + "guzzle/plugin-error-response": "self.version", + "guzzle/plugin-history": "self.version", + "guzzle/plugin-log": "self.version", + "guzzle/plugin-md5": "self.version", + "guzzle/plugin-mock": "self.version", + "guzzle/plugin-oauth": "self.version", + "guzzle/service": "self.version", + "guzzle/stream": "self.version" + }, + "require-dev": { + "doctrine/cache": "~1.3", + "monolog/monolog": "~1.0", + "phpunit/phpunit": "3.7.*", + "psr/log": "~1.0", + "symfony/class-loader": "~2.1", + "zendframework/zend-cache": "2.*,<2.3", + "zendframework/zend-log": "2.*,<2.3" + }, + "suggest": { + "guzzlehttp/guzzle": "Guzzle 5 has moved to a new package name. The package you have installed, Guzzle 3, is deprecated." + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.9-dev" + } + }, + "autoload": { + "psr-0": { + "Guzzle": "src/", + "Guzzle\\Tests": "tests/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Michael Dowling", + "email": "mtdowling@gmail.com", + "homepage": "https://github.com/mtdowling" + }, + { + "name": "Guzzle Community", + "homepage": "https://github.com/guzzle/guzzle/contributors" + } + ], + "description": "PHP HTTP client. This library is deprecated in favor of https://packagist.org/packages/guzzlehttp/guzzle", + "homepage": "http://guzzlephp.org/", + "keywords": [ + "client", + "curl", + "framework", + "http", + "http client", + "rest", + "web service" + ], + "abandoned": "guzzlehttp/guzzle", + "time": "2015-03-18 18:23:50" + }, + { + "name": "padraic/humbug_get_contents", + "version": "1.0.4", + "source": { + "type": "git", + "url": "https://github.com/padraic/file_get_contents.git", + "reference": "66797199019d0cb4529cb8d29c6f0b4c5085b53a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/padraic/file_get_contents/zipball/66797199019d0cb4529cb8d29c6f0b4c5085b53a", + "reference": "66797199019d0cb4529cb8d29c6f0b4c5085b53a", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Humbug\\": "src/Humbug/" + }, + "files": [ + "src/function.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + } + ], + "description": "Secure wrapper for accessing HTTPS resources with file_get_contents for PHP 5.3+", + "homepage": "https://github.com/padraic/file_get_contents", + "keywords": [ + "download", + "file_get_contents", + "http", + "https", + "ssl", + "tls" + ], + "time": "2015-04-22 18:45:00" + }, + { + "name": "padraic/phar-updater", + "version": "1.0.3", + "source": { + "type": "git", + "url": "https://github.com/padraic/phar-updater.git", + "reference": "c17eeb3887dc4269d1b4837dc875d39e9f8149a8" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/padraic/phar-updater/zipball/c17eeb3887dc4269d1b4837dc875d39e9f8149a8", + "reference": "c17eeb3887dc4269d1b4837dc875d39e9f8149a8", + "shasum": "" + }, + "require": { + "padraic/humbug_get_contents": "^1.0", + "php": ">=5.3.3" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Humbug\\SelfUpdate\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pádraic Brady", + "email": "padraic.brady@gmail.com", + "homepage": "http://blog.astrumfutura.com" + } + ], + "description": "A thing to make PHAR self-updating easy and secure.", + "keywords": [ + "humbug", + "phar", + "self-update", + "update" + ], + "time": "2016-01-05 23:08:01" + }, { "name": "phpspec/prophecy", "version": "v1.6.2", @@ -3270,6 +3541,64 @@ ], "time": "2015-10-02 06:51:40" }, + { + "name": "satooshi/php-coveralls", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/satooshi/php-coveralls.git", + "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/satooshi/php-coveralls/zipball/da51d304fe8622bf9a6da39a8446e7afd432115c", + "reference": "da51d304fe8622bf9a6da39a8446e7afd432115c", + "shasum": "" + }, + "require": { + "ext-json": "*", + "ext-simplexml": "*", + "guzzle/guzzle": "^2.8|^3.0", + "php": ">=5.3.3", + "psr/log": "^1.0", + "symfony/config": "^2.1|^3.0", + "symfony/console": "^2.1|^3.0", + "symfony/stopwatch": "^2.0|^3.0", + "symfony/yaml": "^2.0|^3.0" + }, + "suggest": { + "symfony/http-kernel": "Allows Symfony integration" + }, + "bin": [ + "bin/coveralls" + ], + "type": "library", + "autoload": { + "psr-4": { + "Satooshi\\": "src/Satooshi/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kitamura Satoshi", + "email": "with.no.parachute@gmail.com", + "homepage": "https://www.facebook.com/satooshi.jp" + } + ], + "description": "PHP client library for Coveralls API", + "homepage": "https://github.com/satooshi/php-coveralls", + "keywords": [ + "ci", + "coverage", + "github", + "test" + ], + "time": "2016-01-20 17:35:46" + }, { "name": "sebastian/comparator", "version": "1.2.2", @@ -3641,11 +3970,62 @@ "description": "Library that helps with managing the version number of Git-hosted PHP projects", "homepage": "https://github.com/sebastianbergmann/version", "time": "2015-06-21 13:59:46" + }, + { + "name": "symfony/stopwatch", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/stopwatch.git", + "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b139e1c4290e6c7640ba80d9c9b5e49ef22b841", + "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841", + "shasum": "" + }, + "require": { + "php": ">=5.5.9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Stopwatch\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Stopwatch Component", + "homepage": "https://symfony.com", + "time": "2016-06-29 05:43:10" } ], "aliases": [], "minimum-stability": "RC", - "stability-flags": [], + "stability-flags": { + "codeclimate/php-test-reporter": 20 + }, "prefer-stable": false, "prefer-lowest": false, "platform": { From b858f755d80be8a02e06f326b046afc65654bff8 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Mon, 19 Dec 2016 17:53:42 +0100 Subject: [PATCH 03/24] Don't show scrutinizer stuff here --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index c912fc8..3558ef3 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,6 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![Build Status](https://travis-ci.org/digipolisgent/robo-drupal-console.svg?branch=develop)](https://travis-ci.org/digipolisgent/robo-drupal-console) [![Code Climate](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/gpa.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console) [![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console/coverage) -[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/digipolisgent/robo-drupal-console/badges/quality-score.png?b=develop)](https://scrutinizer-ci.com/g/digipolisgent/robo-drupal-console/?branch=develop) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9/mini.png)](https://insight.sensiolabs.com/projects/8940f64e-cebe-46de-b670-5a89fb0388a9) [![Dependency Status](https://www.versioneye.com/user/projects/58500a7dfbe933004aa47165/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/58500a7dfbe933004aa47165) From 309ac65a8451e6dbc03ea7e25e3c8dbace7b42d1 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Mon, 19 Dec 2016 18:03:08 +0100 Subject: [PATCH 04/24] Update test reporter token --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 0e8a95b..11b7a7a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,6 @@ script: - vendor/bin/robo test:coverage-codeclimate addons: code_climate: - repo_token: 0e809aae8958c6e4ad800d73c94551aca9c96d969be0942fc5140a720698acdb + repo_token: 3798532b8ba006dda3541198ac9e2b9b21825dc476540ee1d9397b0665f8d033 after_success: - vendor/bin/test-reporter \ No newline at end of file From 5ccbcbd4932637ad3c312a077b4544a57f065840 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:08:05 +0100 Subject: [PATCH 05/24] Fix README.md code violations --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ecb32d2..16da53a 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,8 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console/coverage) [![Dependency Status](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23) -Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console commands in stack. You can define global options for all commands (like Drupal root and uri). +Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console commands in stack. You +can define global options for all commands (like Drupal root and uri). ## Table of contents From 1ed0294a24ae3eb1a74e5969a355a8618f8ef6bd Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:09:12 +0100 Subject: [PATCH 06/24] Fix RoboFile.php code violations --- RoboFile.php | 1 - 1 file changed, 1 deletion(-) diff --git a/RoboFile.php b/RoboFile.php index cdaf8bd..c3b8133 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -36,5 +36,4 @@ public function testCoverageCodeclimate() ->arg('tests') ->run(); } - } From 2a23a0fe6ae33f853ec9f21af277493b050ff0d4 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:12:48 +0100 Subject: [PATCH 07/24] Fix (some) code violations on DrupalConsoleStackTest.php --- tests/DrupalConsoleStackTest.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/DrupalConsoleStackTest.php b/tests/DrupalConsoleStackTest.php index 8834df9..91ed59d 100644 --- a/tests/DrupalConsoleStackTest.php +++ b/tests/DrupalConsoleStackTest.php @@ -560,7 +560,10 @@ public function testAccountPassOption() public function testGetVersion() { // @todo: fails: DrupalConsole must be executed within a Drupal Site. - //$this->assertEquals(Drupal\Console\Application::VERSION, $this->taskDrupalConsoleStack(__DIR__ . '/../vendor/bin/drupal')->getVersion()); +// $this->assertEquals(Drupal\Console\Application::VERSION, +// $this->taskDrupalConsoleStack(__DIR__.'/../vendor/bin/drupal') +// ->getVersion() +// ); $this->assertEquals( 'unknown', $this->taskDrupalConsoleStack(__DIR__.'/../vendor/bin/drupal') From 5a17517e531d13ed43ecc5d766b9d055e93d3ffb Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:23:45 +0100 Subject: [PATCH 08/24] Fix README code violations (line length 100) --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 16da53a..235964b 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,8 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console/coverage) [![Dependency Status](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23) -Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console commands in stack. You -can define global options for all commands (like Drupal root and uri). +Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console +commands in stack. You can define global options for all commands (like Drupal root and uri). ## Table of contents From c050259112c3b54b87a9a8f05f0c99355a8c8185 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:23:58 +0100 Subject: [PATCH 09/24] Fix (most) code violations in DrupalConsoleStack.php --- src/DrupalConsoleStack.php | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/src/DrupalConsoleStack.php b/src/DrupalConsoleStack.php index e488159..d1849b3 100644 --- a/src/DrupalConsoleStack.php +++ b/src/DrupalConsoleStack.php @@ -6,9 +6,9 @@ use Robo\Task\CommandStack; /** - * Runs Drupal Console commands in stack. You can use `stopOnFail()` to point that stack should be terminated on first fail. - * You can define global options for all commands (like Drupal root and uri). - * The option --yes is always set, as it makes sense in a task runner. + * Runs Drupal Console commands in stack. You can use `stopOnFail()` to point that stack should be terminated on + * first fail. You can define global options for all commands (like Drupal root and uri). The option --yes is always + * set, as it makes sense in a task runner. * * ``` php * $this->taskDrupalConsoleStack() @@ -59,7 +59,7 @@ class DrupalConsoleStack extends CommandStack * * @var array */ - protected $optionsForNextCommand = []; + protected $optionsForNextCmd = []; /** @@ -116,7 +116,7 @@ protected function optionForNextCommand($name, $value = null) */ protected function optionsForNextCommand($options) { - $this->optionsForNextCommand = $options + $this->optionsForNextCommand; + $this->optionsForNextCmd = $options + $this->optionsForNextCmd; return $this; } @@ -474,7 +474,8 @@ public function getVersion() $result = $this->executeCommand($this->executable.' --version'); $output = $result->getMessage(); $this->drupalConsoleVersion = 'unknown'; - if ($result->wasSuccessful() && preg_match( + if ($result->wasSuccessful() && + preg_match( '#[0-9.]+#', $output, $matches @@ -573,8 +574,8 @@ public function siteInstall($installationProfile = '') { return $this->drupal( 'site:install'.($installationProfile ? ' '.static::escape( - $installationProfile - ) : '') + $installationProfile + ) : '') ); } @@ -729,25 +730,24 @@ public function drupal($command, $assumeYes = true) */ protected function injectArguments($command, $assumeYes) { - $optionsForNextCommand = ''; - foreach ($this->optionsForNextCommand as $option => $value) { - $optionsForNextCommand .= ' --'.$option.(is_null( - $value - ) ? '' : ' '.static::escape($value)); + $optionsForNextCmd = ''; + foreach ($this->optionsForNextCmd as $option => $value) { + $optionsForNextCmd .= ' --'.$option.( + is_null($value) ? '' : ' '.static::escape($value) + ); } $cmd = $command; if (trim($this->arguments)) { $cmd .= $this->arguments; } - if (trim($optionsForNextCommand)) { - $cmd .= $optionsForNextCommand; + if (trim($optionsForNextCmd)) { + $cmd .= $optionsForNextCmd; } if ($assumeYes) { $cmd .= ' --yes'; } - $this->optionsForNextCommand = []; + $this->optionsForNextCmd = []; return $cmd; } - } From 654c2cf5179213caaac735c61174e9f8c4110c83 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:24:07 +0100 Subject: [PATCH 10/24] Fix code violations in loadTasks.php --- src/loadTasks.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/loadTasks.php b/src/loadTasks.php index 6114a11..82b3770 100644 --- a/src/loadTasks.php +++ b/src/loadTasks.php @@ -18,5 +18,4 @@ protected function taskDrupalConsoleStack($pathToDrupalConsole = 'drupal') { return $this->task(DrupalConsoleStack::class, $pathToDrupalConsole); } - } From 807495bc64ead0cda0ee906299631262a3d996c1 Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:25:56 +0100 Subject: [PATCH 11/24] Markdown: 80 for line length --- README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 235964b..0aafc97 100644 --- a/README.md +++ b/README.md @@ -14,8 +14,9 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![Test Coverage](https://codeclimate.com/github/digipolisgent/robo-drupal-console/badges/coverage.svg)](https://codeclimate.com/github/digipolisgent/robo-drupal-console/coverage) [![Dependency Status](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23) -Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs Drupal Console -commands in stack. You can define global options for all commands (like Drupal root and uri). +Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs +Drupal Console commands in stack. You can define global options for all +commands (like Drupal root and uri). ## Table of contents From 0444589ab6cc9d8edd23a3979942377a2f2ce41b Mon Sep 17 00:00:00 2001 From: Dieter Blomme Date: Wed, 21 Dec 2016 18:26:54 +0100 Subject: [PATCH 12/24] Trailing spaces Too used to them being removed automatically --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 0aafc97..596393a 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Extension to execute Drupal Console commands in [Robo](http://robo.li/). [![Dependency Status](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23/badge.svg?style=flat-square)](https://www.versioneye.com/user/projects/585aaebacd6569002cd5bc23) Created based on [Robo DrushStack](https://github.com/boedah/robo-drush). Runs -Drupal Console commands in stack. You can define global options for all +Drupal Console commands in stack. You can define global options for all commands (like Drupal root and uri). ## Table of contents From 00fd373bbef2afbe687932a0f334bd3766705bcc Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 16:30:46 +0100 Subject: [PATCH 13/24] Add repo token in after_success script --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 11b7a7a..140ece1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ addons: code_climate: repo_token: 3798532b8ba006dda3541198ac9e2b9b21825dc476540ee1d9397b0665f8d033 after_success: - - vendor/bin/test-reporter \ No newline at end of file + - CODECLIMATE_REPO_TOKEN="3798532b8ba006dda3541198ac9e2b9b21825dc476540ee1d9397b0665f8d033" vendor/bin/test-reporter From cd53076745ca458c1f4fd5fd8af62bb5ed568452 Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 16:35:49 +0100 Subject: [PATCH 14/24] Output file should be what codeclimate expects --- RoboFile.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RoboFile.php b/RoboFile.php index c3b8133..5d3130f 100644 --- a/RoboFile.php +++ b/RoboFile.php @@ -32,7 +32,7 @@ public function testCoverageCodeclimate() ->option('report-useless-tests') ->option('strict-coverage') ->option('-d error_reporting=-1') - ->option('--coverage-clover=coverage.clover') + ->option('--coverage-clover=build/logs/clover.xml') ->arg('tests') ->run(); } From 22c4ac3cebf5e429336d9bbe61dc8bdb0f3ec8dc Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 16:44:32 +0100 Subject: [PATCH 15/24] Token in command, will it work? --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 140ece1..34b49e3 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,4 +13,4 @@ addons: code_climate: repo_token: 3798532b8ba006dda3541198ac9e2b9b21825dc476540ee1d9397b0665f8d033 after_success: - - CODECLIMATE_REPO_TOKEN="3798532b8ba006dda3541198ac9e2b9b21825dc476540ee1d9397b0665f8d033" vendor/bin/test-reporter + - vendor/bin/test-reporter From c544b91a921219fcc78a7cf821dba8da69faadce Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 17:08:28 +0100 Subject: [PATCH 16/24] Add PHPUnit.xml file to steer code coverage report --- phpunit.xml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 phpunit.xml diff --git a/phpunit.xml b/phpunit.xml new file mode 100644 index 0000000..c953a52 --- /dev/null +++ b/phpunit.xml @@ -0,0 +1,33 @@ + + + + + + ./tests + + + + + ./src + + + ./vendor + + + + + + From 04d445a705fbf641e8224ba2d1b84ab9c9a2d27d Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 17:12:22 +0100 Subject: [PATCH 17/24] Let's remove some cruft --- phpunit.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index c953a52..0b9a14b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -2,17 +2,6 @@ From 214095ad1983114c9fabfc2382eca27a6a90e829 Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 17:30:51 +0100 Subject: [PATCH 18/24] Update PHPUnit version --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 76e2843..008d9b1 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~4.4", + "phpunit/phpunit": "~5.7", "codeclimate/php-test-reporter": "dev-master" }, "autoload": { From 3a303463f44bb31c9c2b6d56d3748aee6b3b6131 Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 17:48:51 +0100 Subject: [PATCH 19/24] blacklist element not needed (and no longer present) --- phpunit.xml | 3 --- 1 file changed, 3 deletions(-) diff --git a/phpunit.xml b/phpunit.xml index 0b9a14b..316875b 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -12,9 +12,6 @@ ./src - - ./vendor - From 8a27175bf3eebbb2d67e12a4864327efd8efc6a6 Mon Sep 17 00:00:00 2001 From: daften Date: Thu, 22 Dec 2016 18:02:09 +0100 Subject: [PATCH 20/24] Revert "Update PHPUnit version", we need to support PHP 5.5 This reverts commit 214095ad1983114c9fabfc2382eca27a6a90e829. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 008d9b1..76e2843 100644 --- a/composer.json +++ b/composer.json @@ -10,7 +10,7 @@ "php": ">=5.5.0" }, "require-dev": { - "phpunit/phpunit": "~5.7", + "phpunit/phpunit": "~4.4", "codeclimate/php-test-reporter": "dev-master" }, "autoload": { From d674b395a269966c0ca2890f4d6bfba9b166e08b Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Tue, 27 Dec 2016 11:47:28 +0100 Subject: [PATCH 21/24] Exclude tests form codeclimate checks. --- .codeclimate.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.codeclimate.yml b/.codeclimate.yml index 8c11231..3d45e0d 100644 --- a/.codeclimate.yml +++ b/.codeclimate.yml @@ -21,3 +21,4 @@ ratings: exclude_paths: - "**/vendor/**/*" - "**/.idea/**/*" +- "tests/" From d5cef3201219d3e86deb8933981efcb7b3ca28e6 Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Mon, 30 Jan 2017 10:01:07 +0100 Subject: [PATCH 22/24] Issue #6: Fix too many arguments error. --- src/DrupalConsoleStack.php | 29 +++++++++++++++++++--- tests/DrupalConsoleStackTest.php | 42 ++++++++++++++++---------------- 2 files changed, 47 insertions(+), 24 deletions(-) diff --git a/src/DrupalConsoleStack.php b/src/DrupalConsoleStack.php index d1849b3..12176b5 100644 --- a/src/DrupalConsoleStack.php +++ b/src/DrupalConsoleStack.php @@ -44,7 +44,9 @@ class DrupalConsoleStack extends CommandStack { - use CommandArguments; + use CommandArguments { + option as optionNoEqualSign; + } /** * Verbosity levels: @@ -89,6 +91,27 @@ public function __construct($pathToDrupalConsole = 'drupal') $this->executable = $pathToDrupalConsole; } + /** + * Pass option to executable. Options are prefixed with `--` , value can be provided in second parameter. + * Option values are automatically escaped. + * + * @param string $option + * The option name. + * @param string $value + * The option value. + * + * @return $this + */ + public function option($option, $value = null) + { + if ($option !== null and strpos($option, '-') !== 0) { + $option = "--$option"; + } + $this->arguments .= null == $option ? '' : " " . $option; + $this->arguments .= null == $value ? '' : "=" . static::escape($value); + return $this; + } + /** * Pass an option to the executable; applies to the next command only. * @@ -732,8 +755,8 @@ protected function injectArguments($command, $assumeYes) { $optionsForNextCmd = ''; foreach ($this->optionsForNextCmd as $option => $value) { - $optionsForNextCmd .= ' --'.$option.( - is_null($value) ? '' : ' '.static::escape($value) + $optionsForNextCmd .= ' --' . $option . ( + is_null($value) ? '' : '=' . static::escape($value) ); } $cmd = $command; diff --git a/tests/DrupalConsoleStackTest.php b/tests/DrupalConsoleStackTest.php index 91ed59d..16f9fc4 100644 --- a/tests/DrupalConsoleStackTest.php +++ b/tests/DrupalConsoleStackTest.php @@ -109,7 +109,7 @@ public function testOptionsArePrependedBeforeEachCommand() ->drupal('command-1') ->drupal('command-2') ->getCommand(); - $this->assertRegExp('#--root /var/www/html/app#', $command); + $this->assertRegExp('#--root=/var/www/html/app#', $command); } /** @@ -300,7 +300,7 @@ public function testListCommandOutsideDrupalSite() public function testDrupalRootDirectoryOption() { $this->assertEquals( - 'drupal command --root '.static::escape(__DIR__), + 'drupal command --root='.static::escape(__DIR__), $this->getTestOptionCommand('drupalRootDirectory', __DIR__) ); } @@ -311,7 +311,7 @@ public function testDrupalRootDirectoryOption() public function testUriOption() { $this->assertEquals( - 'drupal command --uri '.static::escape('http://example.com'), + 'drupal command --uri='.static::escape('http://example.com'), $this->getTestOptionCommand('uri', 'http://example.com') ); } @@ -322,7 +322,7 @@ public function testUriOption() public function testEnvironmentOption() { $this->assertEquals( - 'drupal command --env prod', + 'drupal command --env=prod', $this->getTestOptionCommand('environment', 'prod') ); } @@ -350,7 +350,7 @@ public function testVerboseOption() ]; foreach ($levels as $level) { $this->assertEquals( - 'drupal command --verbose '.$level, + 'drupal command --verbose='.$level, $this->getTestOptionCommand('verbose', $level) ); } @@ -362,7 +362,7 @@ public function testVerboseOption() public function testSiteNameOption() { $this->assertEquals( - 'drupal command --site-name Digipolis', + 'drupal command --site-name=Digipolis', $this->getTestOptionCommand('siteName', 'Digipolis') ); } @@ -373,7 +373,7 @@ public function testSiteNameOption() public function testSiteMailOption() { $this->assertEquals( - 'drupal command --site-mail digipolis@example.com', + 'drupal command --site-mail=digipolis@example.com', $this->getTestOptionCommand('siteMail', 'digipolis@example.com') ); } @@ -384,7 +384,7 @@ public function testSiteMailOption() public function testFileOption() { $this->assertEquals( - 'drupal command --file '.static::escape(__FILE__), + 'drupal command --file='.static::escape(__FILE__), $this->getTestOptionCommand('file', __FILE__) ); } @@ -395,7 +395,7 @@ public function testFileOption() public function testDirectoryOption() { $this->assertEquals( - 'drupal command --directory '.static::escape(__DIR__), + 'drupal command --directory='.static::escape(__DIR__), $this->getTestOptionCommand('directory', __DIR__) ); } @@ -417,7 +417,7 @@ public function testTarOption() public function testLangcodeOption() { $this->assertEquals( - 'drupal command --langcode nl', + 'drupal command --langcode=nl', $this->getTestOptionCommand('langcode', 'nl') ); } @@ -428,7 +428,7 @@ public function testLangcodeOption() public function testDbTypeOption() { $this->assertEquals( - 'drupal command --db-type mysql', + 'drupal command --db-type=mysql', $this->getTestOptionCommand('dbType', 'mysql') ); } @@ -439,7 +439,7 @@ public function testDbTypeOption() public function testDbFileOption() { $this->assertEquals( - 'drupal command --db-file .h.sqlite', + 'drupal command --db-file=.h.sqlite', $this->getTestOptionCommand('dbFile', '.h.sqlite') ); } @@ -450,7 +450,7 @@ public function testDbFileOption() public function testDbHostOption() { $this->assertEquals( - 'drupal command --db-host localhost', + 'drupal command --db-host=localhost', $this->getTestOptionCommand('dbHost', 'localhost') ); } @@ -461,7 +461,7 @@ public function testDbHostOption() public function testDbNameOption() { $this->assertEquals( - 'drupal command --db-name db_digipolis', + 'drupal command --db-name=db_digipolis', $this->getTestOptionCommand('dbName', 'db_digipolis') ); } @@ -472,7 +472,7 @@ public function testDbNameOption() public function testDbUserOption() { $this->assertEquals( - 'drupal command --db-user db_user', + 'drupal command --db-user=db_user', $this->getTestOptionCommand('dbUser', 'db_user') ); } @@ -483,7 +483,7 @@ public function testDbUserOption() public function testDbPassOption() { $this->assertEquals( - 'drupal command --db-pass db_pass', + 'drupal command --db-pass=db_pass', $this->getTestOptionCommand('dbPass', 'db_pass') ); } @@ -494,7 +494,7 @@ public function testDbPassOption() public function testDbPrefixOption() { $this->assertEquals( - 'drupal command --db-prefix prefix_', + 'drupal command --db-prefix=prefix_', $this->getTestOptionCommand('dbPrefix', 'prefix_') ); } @@ -505,7 +505,7 @@ public function testDbPrefixOption() public function testDbPortOption() { $this->assertEquals( - 'drupal command --db-port 1234', + 'drupal command --db-port=1234', $this->getTestOptionCommand('dbPort', '1234') ); } @@ -516,7 +516,7 @@ public function testDbPortOption() public function testAccountMailOption() { $this->assertEquals( - 'drupal command --account-mail account@example.com', + 'drupal command --account-mail=account@example.com', $this->getTestOptionCommand('accountMail', 'account@example.com') ); $this->getTestOptionCommand( @@ -532,7 +532,7 @@ public function testAccountMailOption() public function testAccountNameOption() { $this->assertEquals( - 'drupal command --account-name accountName', + 'drupal command --account-name=accountName', $this->getTestOptionCommand('accountName', 'accountName') ); $this->getTestOptionCommand( @@ -548,7 +548,7 @@ public function testAccountNameOption() public function testAccountPassOption() { $this->assertEquals( - 'drupal command --account-pass MyPwD123_', + 'drupal command --account-pass=MyPwD123_', $this->getTestOptionCommand('accountPass', 'MyPwD123_') ); $this->getTestOptionCommand('accountPass', 'account-pass', 'MyPwD123_'); From eef7af92c4a394d184e48a825a10d3174f9312fa Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Mon, 30 Jan 2017 10:04:39 +0100 Subject: [PATCH 23/24] Code style fixes. --- src/DrupalConsoleStack.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DrupalConsoleStack.php b/src/DrupalConsoleStack.php index 12176b5..a2c50ad 100644 --- a/src/DrupalConsoleStack.php +++ b/src/DrupalConsoleStack.php @@ -104,11 +104,11 @@ public function __construct($pathToDrupalConsole = 'drupal') */ public function option($option, $value = null) { - if ($option !== null and strpos($option, '-') !== 0) { + if (!is_null($option) && strpos($option, '-') !== 0) { $option = "--$option"; } - $this->arguments .= null == $option ? '' : " " . $option; - $this->arguments .= null == $value ? '' : "=" . static::escape($value); + $this->arguments .= is_null($option) ? '' : " " . $option; + $this->arguments .= is_null($value) ? '' : "=" . static::escape($value); return $this; } From 50b26fcfe09d84807e78d873b64903f8eeb12ba8 Mon Sep 17 00:00:00 2001 From: Jelle Sebreghts Date: Mon, 30 Jan 2017 10:04:39 +0100 Subject: [PATCH 24/24] Fixes #6 --- src/DrupalConsoleStack.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/DrupalConsoleStack.php b/src/DrupalConsoleStack.php index 12176b5..a2c50ad 100644 --- a/src/DrupalConsoleStack.php +++ b/src/DrupalConsoleStack.php @@ -104,11 +104,11 @@ public function __construct($pathToDrupalConsole = 'drupal') */ public function option($option, $value = null) { - if ($option !== null and strpos($option, '-') !== 0) { + if (!is_null($option) && strpos($option, '-') !== 0) { $option = "--$option"; } - $this->arguments .= null == $option ? '' : " " . $option; - $this->arguments .= null == $value ? '' : "=" . static::escape($value); + $this->arguments .= is_null($option) ? '' : " " . $option; + $this->arguments .= is_null($value) ? '' : "=" . static::escape($value); return $this; }