#1164 Add --ignore-platform-reqs in composer plugin

This commit is contained in:
Martin Fasani 2016-01-19 13:27:39 +01:00
parent 42bea5f876
commit f43dda0506

View file

@ -28,6 +28,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $phpci;
protected $build;
protected $nodev;
protected $ignorePlatformReqs;
/**
* Check if this plugin can be executed.
@ -62,6 +63,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$this->action = 'install';
$this->preferDist = false;
$this->nodev = false;
$this->ignorePlatformReqs = false;
if (array_key_exists('directory', $options)) {
$this->directory = $path . DIRECTORY_SEPARATOR . $options['directory'];
@ -78,6 +80,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
if (array_key_exists('no_dev', $options)) {
$this->nodev = (bool)$options['no_dev'];
}
if (array_key_exists('ignore_platform_reqs', $options)) {
$this->ignorePlatformReqs = (bool)$options['ignore_platform_reqs'];
}
}
/**
@ -108,6 +114,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
$cmd .= ' --no-dev';
}
if ($this->ignorePlatformReqs) {
$this->phpci->log('Using --ignore-platform-reqs flag');
$cmd .= ' --ignore-platform-reqs';
}
$cmd .= ' --working-dir="%s" %s';
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);