Adding an option for Plugin::Composer to pass the no_dev option. If set to true, it will execute composer with the --no-dev option, which usually suffices for testing in most projects. Default is set to false.
Closed #987
This commit is contained in:
parent
d34818f029
commit
3784cc8ea9
|
@ -27,6 +27,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
protected $preferDist;
|
||||
protected $phpci;
|
||||
protected $build;
|
||||
protected $nodev;
|
||||
|
||||
/**
|
||||
* Check if this plugin can be executed.
|
||||
|
@ -60,6 +61,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
$this->directory = $path;
|
||||
$this->action = 'install';
|
||||
$this->preferDist = false;
|
||||
$this->nodev = false;
|
||||
|
||||
if (array_key_exists('directory', $options)) {
|
||||
$this->directory = $path . '/' . $options['directory'];
|
||||
|
@ -72,6 +74,10 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
if (array_key_exists('prefer_dist', $options)) {
|
||||
$this->preferDist = (bool)$options['prefer_dist'];
|
||||
}
|
||||
|
||||
if (array_key_exists('no_dev', $options)) {
|
||||
$this->nodev = (bool)$options['no_dev'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -97,6 +103,11 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
|
|||
$cmd .= '--prefer-source';
|
||||
}
|
||||
|
||||
if ($this->nodev) {
|
||||
$this->phpci->log('Using --no-dev flag');
|
||||
$cmd .= ' --no-dev';
|
||||
}
|
||||
|
||||
$cmd .= ' --working-dir="%s" %s';
|
||||
|
||||
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);
|
||||
|
|
Loading…
Reference in a new issue