From 01ad8e4e4f17be355263f27e51b5bf3da7657695 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kinn=20Coelho=20Juli=C3=A3o?= Date: Thu, 16 May 2013 19:23:37 -0400 Subject: [PATCH] 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" --- PHPCI/Plugin/Shell.php | 48 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 PHPCI/Plugin/Shell.php diff --git a/PHPCI/Plugin/Shell.php b/PHPCI/Plugin/Shell.php new file mode 100644 index 00000000..602824ec --- /dev/null +++ b/PHPCI/Plugin/Shell.php @@ -0,0 +1,48 @@ + +* @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; + } +}