Defaulting to using neither --prefer-source or --prefer-dist for composer. Allow user to specify either.

This commit is contained in:
Dan Cryer 2016-04-27 15:20:20 +01:00
parent 21d5f4954f
commit 6418fde928
2 changed files with 11 additions and 4 deletions

View File

@ -13,7 +13,6 @@ build_settings:
setup:
composer:
action: "install"
prefer_dist: false
test:
php_parallel_lint:

View File

@ -61,6 +61,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->directory = $path;
$this->action = 'install';
$this->preferDist = false;
$this->preferSource = false;
$this->nodev = false;
if (array_key_exists('directory', $options)) {
@ -75,6 +76,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->preferDist = (bool)$options['prefer_dist'];
}
if (array_key_exists('prefer_source', $options)) {
$this->preferDist = false;
$this->preferSource = (bool)$options['prefer_source'];
}
if (array_key_exists('no_dev', $options)) {
$this->nodev = (bool)$options['no_dev'];
}
@ -97,10 +103,12 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
if ($this->preferDist) {
$this->phpci->log('Using --prefer-dist flag');
$cmd .= '--prefer-dist';
} else {
$cmd .= ' --prefer-dist';
}
if ($this->preferSource) {
$this->phpci->log('Using --prefer-source flag');
$cmd .= '--prefer-source';
$cmd .= ' --prefer-source';
}
if ($this->nodev) {