diff --git a/PHPCI/Plugin/CopyBuild.php b/PHPCI/Plugin/CopyBuild.php new file mode 100644 index 00000000..dac0b3a2 --- /dev/null +++ b/PHPCI/Plugin/CopyBuild.php @@ -0,0 +1,54 @@ + +* @package PHPCI +* @subpackage Plugins +*/ +class CopyBuild implements \PHPCI\Plugin +{ + protected $directory; + protected $phpci; + + public function __construct(\PHPCI\Builder $phpci, array $options = array()) + { + $path = $phpci->buildPath; + $this->phpci = $phpci; + $this->directory = isset($options['directory']) ? $options['directory'] : $path; + $this->ignore = isset($options['respect_ignore']) ? (bool)$options['respect_ignore'] : false; + } + + /** + * Executes Composer and runs a specified command (e.g. install / update) + */ + public function execute() + { + $build = $this->phpci->buildPath; + + if ($this->directory == $build) { + return false; + } + + $cmd = 'mkdir -p "%s" && cp -Rf "%s" "%s/"'; + $success = $this->phpci->executeCommand($cmd, $this->directory, $build, $this->directory); + + if ($this->ignore) { + foreach ($this->phpci->ignore as $file) { + $cmd = 'rm -Rf "%s/%s"'; + $this->phpci->executeCommand($cmd, $this->directory, $file); + } + } + + return $success; + } +} diff --git a/phpci.yml b/phpci.yml index 6bd1a211..c05b7509 100644 --- a/phpci.yml +++ b/phpci.yml @@ -13,5 +13,11 @@ setup: test: php_mess_detector: + allow_failures: true php_code_sniffer: - standard: "PSR2" \ No newline at end of file + standard: "PSR2" + +success: + copy_build: + directory: /www/phpci + respect_ignore: false \ No newline at end of file