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:
mulleto 2015-05-21 14:23:06 +02:00 committed by Tobias van Beek
parent d34818f029
commit 3784cc8ea9

View file

@ -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);