phpci/PHPCI/Plugin/Composer.php
2013-05-16 02:16:56 +01:00

29 lines
831 B
PHP

<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2013, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link http://www.phptesting.org/
*/
namespace PHPCI\Plugin;
class Composer implements \PHPCI\Plugin
{
protected $directory;
protected $action;
protected $phpci;
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $phpci->buildPath . '/' . $options['directory'] : $phpci->buildPath;
$this->action = isset($options['action']) ? $options['action'] : 'update';
}
public function execute()
{
return $this->phpci->executeCommand(PHPCI_DIR . 'composer.phar --prefer-dist --working-dir="%s" %s', $this->directory, $this->action);
}
}