Composer ignores whitelist
I have the following sections require
in composer.json
:
"require": {
"php": ">=5.4.0"
},
"require-dev": {
"phpspec/phpspec": "~2.0",
"henrikbjorn/phpspec-code-coverage": "~0.2",
"satooshi/php-coveralls": "~0.6"
},
Now I want to use Travis-CI for PHP 5.4 and 5.5 and hhvm. However, since hhvm does not support xdebug and therefore does not cover code, I need to turn off code coverage for hhvm builds.
For this I need to exclude code coverage settings. However, when I try to install only phpspec under control composer update phpspec/phpspec
, the other two dependencies get installed as well. Somehow Composer seems to be ignoring my whitelist.
This is my current one .travis.yml
:
language: php
php: [5.4, 5.5, hhvm]
install:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then composer update ; fi
- if [[ $TRAVIS_PHP_VERSION == 'hhvm' ]]; then composer update phpspec/phpspec; fi
script:
- bin/phpspec run --format=pretty
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then bin/coveralls -v ; fi
How can I achieve my goal using the whitelist feature, or is there any other way to achieve this?
Please note that I do not want to install henrikbjorn/phpspec-code-coverage
, not satooshi/php-coveralls
in the hhvm assembly . I want to install them in PHP 5.4 and 5.5 builds.
source to share
I would follow the reverse logic of the accepted answer, as it is better to use a workaround when testing and not force yourself not to create local coverage.
language: php
php:
- 5.4
- 5.5
- hhvm
script:
- bin/phpspec run
- bash -c 'if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then bin/coveralls -v; fi;'
before_script:
- bash -c 'if [ "$TRAVIS_PHP_VERSION" == "hhvm" ]; then composer remove "henrikbjorn/phpspec-code-coverage" --dev --no-update; fi;'
- composer install --prefer-source
source to share
If you don't need code coverage to work elsewhere, why not just change .travis.yml
to require code coverage with composer require henrikbjorn/phpspec-code-coverage=~0.2
:
language: php
php: [5.4, 5.5, hhvm]
install:
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then composer require henrikbjorn/phpspec-code-coverage=~0.2 ; fi
script:
- bin/phpspec run --format=pretty
- if [[ $TRAVIS_PHP_VERSION != 'hhvm' ]]; then bin/coveralls -v ; fi
source to share
Try to run
php composer.phar self-update
php composer.phar update --with-dependencies
According to the documents, it must be indicated what is on the white list
If you only want to update or update the chain with a few packages, do the following
php composer.phar update "packagename" "packagename2"
source to share