From 1a3497986f5e6cf925c4fa1a99e789d2b81dfdd2 Mon Sep 17 00:00:00 2001 From: Tim Ruffing Date: Sun, 7 May 2017 23:20:01 +0200 Subject: [PATCH] Use composer to install PHP_CodeSniffer This makes it possible to require a specific version, which is necessary, because PHPCompatibility is not yet compatible with PHP_CodeSniffer 3. See wimg/PHPCompatibility#367. --- .travis.yml | 13 +++----- Makefile | 2 +- composer.json | 3 ++ composer.lock | 83 +++++++++++++++++++++++++++++++++++++++++++++++++-- 4 files changed, 89 insertions(+), 12 deletions(-) diff --git a/.travis.yml b/.travis.yml index 46622aa..8859560 100644 --- a/.travis.yml +++ b/.travis.yml @@ -18,21 +18,16 @@ before_install: wget https://raw.github.com/splitbrain/dokuwiki-travis/master/tr install: - sh travis.sh - - cd lib/plugins/icalevents && composer install && cd ../../.. + - cd lib/plugins/icalevents && composer install --no-interaction && cd ../../.. before_script: - # Get latest release of PHP_CodeSniffer - - cd /tmp - - wget https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar - - chmod +x phpcs.phar - # Get latest release of PHPCompatibility - git clone -b master https://github.com/wimg/PHPCompatibility.git /tmp/phpcs-extra/PHPCompatibility - cd /tmp/phpcs-extra/PHPCompatibility - git checkout $(git describe --tags `git rev-list --tags --max-count=1`) # Checkout latest tag - cd $TRAVIS_BUILD_DIR - - /tmp/phpcs.phar --config-set installed_paths /tmp/phpcs-extra + - lib/plugins/icalevents/vendor/bin/phpcs --config-set installed_paths /tmp/phpcs-extra # A time zone without daylight saving time for simplified testing (UTC+09:00) - echo 'date.timezone = "Asia/Tokyo"' >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini @@ -40,5 +35,5 @@ before_script: script: - cd _test && phpunit --stderr --group plugin_icalevents && cd .. # Ignore SplitTest.php. It's a false positive; PHPCompatibility does not understand namespaces. - - cd $TRAVIS_BUILD_DIR/lib/plugins/icalevents && /tmp/phpcs.phar --standard=PHPCompatibility --runtime-set testVersion 5.5-7.0 --ignore=_test/,vendor/sabre/uri/tests/SplitTest.php . - - cd $TRAVIS_BUILD_DIR/lib/plugins/icalevents && /tmp/phpcs.phar --standard=PHPCompatibility --runtime-set testVersion 5.3-5.4 --ignore=_test/,syntax-impl.php,vendor/ . + - cd $TRAVIS_BUILD_DIR/lib/plugins/icalevents && ./vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 5.5-7.0 --ignore=_test/,vendor/sabre/uri/tests/SplitTest.php . + - cd $TRAVIS_BUILD_DIR/lib/plugins/icalevents && ./vendor/bin/phpcs --standard=PHPCompatibility --runtime-set testVersion 5.3-5.4 --ignore=_test/,syntax-impl.php,vendor/ . diff --git a/Makefile b/Makefile index fa6b192..0ee50e2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,6 @@ all: dist: git archive HEAD -o $(package_name)-$(version).zip - composer install --ignore-platform-reqs --no-dev + composer install --no-dev rm -rf vendor/bin zip -r $(package_name)-$(version).zip vendor diff --git a/composer.json b/composer.json index 853f25f..a6a54c4 100644 --- a/composer.json +++ b/composer.json @@ -6,5 +6,8 @@ }, "require": { "sabre/vobject": "~4.1" + }, + "require-dev": { + "squizlabs/php_codesniffer": "~2" } } diff --git a/composer.lock b/composer.lock index b2802fb..8381867 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "f8f650c724e06a9666d1911846bf9eb2", + "content-hash": "7891d3475814f6bccef9b7fb76ad50c0", "packages": [ { "name": "sabre/uri", @@ -218,7 +218,86 @@ "time": "2016-10-09T22:57:52+00:00" } ], - "packages-dev": [], + "packages-dev": [ + { + "name": "squizlabs/php_codesniffer", + "version": "2.9.0", + "source": { + "type": "git", + "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", + "reference": "f7dfecbee89d68ab475a6c9e17d22bc9b69aed97" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/f7dfecbee89d68ab475a6c9e17d22bc9b69aed97", + "reference": "f7dfecbee89d68ab475a6c9e17d22bc9b69aed97", + "shasum": "" + }, + "require": { + "ext-simplexml": "*", + "ext-tokenizer": "*", + "ext-xmlwriter": "*", + "php": ">=5.1.2" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "bin": [ + "scripts/phpcs", + "scripts/phpcbf" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.x-dev" + } + }, + "autoload": { + "classmap": [ + "CodeSniffer.php", + "CodeSniffer/CLI.php", + "CodeSniffer/Exception.php", + "CodeSniffer/File.php", + "CodeSniffer/Fixer.php", + "CodeSniffer/Report.php", + "CodeSniffer/Reporting.php", + "CodeSniffer/Sniff.php", + "CodeSniffer/Tokens.php", + "CodeSniffer/Reports/", + "CodeSniffer/Tokenizers/", + "CodeSniffer/DocGenerators/", + "CodeSniffer/Standards/AbstractPatternSniff.php", + "CodeSniffer/Standards/AbstractScopeSniff.php", + "CodeSniffer/Standards/AbstractVariableSniff.php", + "CodeSniffer/Standards/IncorrectPatternException.php", + "CodeSniffer/Standards/Generic/Sniffs/", + "CodeSniffer/Standards/MySource/Sniffs/", + "CodeSniffer/Standards/PEAR/Sniffs/", + "CodeSniffer/Standards/PSR1/Sniffs/", + "CodeSniffer/Standards/PSR2/Sniffs/", + "CodeSniffer/Standards/Squiz/Sniffs/", + "CodeSniffer/Standards/Zend/Sniffs/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Greg Sherwood", + "role": "lead" + } + ], + "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", + "homepage": "http://www.squizlabs.com/php-codesniffer", + "keywords": [ + "phpcs", + "standards" + ], + "time": "2017-05-03T23:30:39+00:00" + } + ], "aliases": [], "minimum-stability": "stable", "stability-flags": [],