Added new Plugin to execute shell commands
There is a %buildpath% parameter, that is optional. If %buildpath% exists, it is changed by the buildpath test: shell: command: "cd %buildpath%; make"
This commit is contained in:
parent
e037f063aa
commit
01ad8e4e4f
48
PHPCI/Plugin/Shell.php
Normal file
48
PHPCI/Plugin/Shell.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?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;
|
||||
|
||||
/**
|
||||
* Shell Plugin - Allows execute shell commands.
|
||||
* @author Kinn Coelho Julião <kinncj@gmail.com>
|
||||
* @package PHPCI
|
||||
* @subpackage Plugins
|
||||
*/
|
||||
class Shell implements \PHPCI\Plugin
|
||||
{
|
||||
protected $args;
|
||||
protected $phpci;
|
||||
|
||||
/**
|
||||
* @var string $command The command to be executed
|
||||
*/
|
||||
protected $command;
|
||||
|
||||
public function __construct(\PHPCI\Builder $phpci, array $options = array())
|
||||
{
|
||||
$this->phpci = $phpci;
|
||||
|
||||
if (isset($options['command'])) {
|
||||
$command = $options['command'];
|
||||
$command = str_replace("%buildpath%", $this->phpci->buildPath, $command);
|
||||
$this->command = $command;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the shell command.
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$success = $this->phpci->executeCommand($this->command);
|
||||
|
||||
return $success;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue