From 3784cc8ea905816ad45120ee58050859af44536d Mon Sep 17 00:00:00 2001 From: mulleto Date: Thu, 21 May 2015 14:23:06 +0200 Subject: [PATCH] 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 --- PHPCI/Plugin/Composer.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/PHPCI/Plugin/Composer.php b/PHPCI/Plugin/Composer.php index 87a558fe..38cf4d0e 100644 --- a/PHPCI/Plugin/Composer.php +++ b/PHPCI/Plugin/Composer.php @@ -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);