phpci/PHPCI/Plugin/Composer.php

38 lines
1.1 KiB
PHP
Raw Normal View History

2013-05-03 17:02:53 +02:00
<?php
2013-05-16 03:16:56 +02:00
/**
* 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/
*/
2013-05-03 17:02:53 +02:00
namespace PHPCI\Plugin;
/**
* Composer Plugin - Provides access to Composer functionality.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
2013-05-03 17:02:53 +02:00
class Composer implements \PHPCI\Plugin
{
protected $directory;
protected $action;
protected $phpci;
2013-05-03 17:02:53 +02:00
public function __construct(\PHPCI\Builder $phpci, array $options = array())
{
$path = $phpci->buildPath;
$this->phpci = $phpci;
$this->directory = isset($options['directory']) ? $path . '/' . $options['directory'] : $path;
$this->action = isset($options['action']) ? $options['action'] : 'update';
}
2013-05-03 17:02:53 +02:00
public function execute()
{
$cmd = PHPCI_DIR . 'composer.phar --prefer-dist --working-dir="%s" %s';
return $this->phpci->executeCommand($cmd, $this->directory, $this->action);
}
}