Merge branch 'master' of github.com:Block8/PHPCI
This commit is contained in:
commit
79b4449794
|
@ -97,7 +97,7 @@ class WebhookController extends \PHPCI\Controller
|
|||
}
|
||||
|
||||
try {
|
||||
$this->_buildStore->save($build);
|
||||
$this->buildStore->save($build); /** bugfix: Errors with PHPCI GitHub hook #296 */
|
||||
} catch (\Exception $ex) {
|
||||
header('HTTP/1.1 500 Internal Server Error');
|
||||
header('Ex: ' . $ex->getMessage());
|
||||
|
|
|
@ -21,6 +21,7 @@ use PHPCI\Model\Build;
|
|||
class CopyBuild implements \PHPCI\Plugin
|
||||
{
|
||||
protected $directory;
|
||||
protected $ignore;
|
||||
protected $phpci;
|
||||
|
||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||
|
@ -32,7 +33,7 @@ class CopyBuild implements \PHPCI\Plugin
|
|||
}
|
||||
|
||||
/**
|
||||
* Executes Composer and runs a specified command (e.g. install / update)
|
||||
* Copies files from the root of the build directory into the target folder
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
|
|
|
@ -32,7 +32,8 @@ class PhpMessDetector implements \PHPCI\Plugin
|
|||
|
||||
/**
|
||||
* @var string, based on the assumption the root may not hold the code to be
|
||||
* tested, exteds the base path
|
||||
* tested, exteds the base path only if the provided path is relative. Absolute
|
||||
* paths are used verbatim
|
||||
*/
|
||||
protected $path;
|
||||
|
||||
|
@ -97,11 +98,16 @@ class PhpMessDetector implements \PHPCI\Plugin
|
|||
$this->phpci->logFailure('Could not find phpmd.');
|
||||
return false;
|
||||
}
|
||||
|
||||
$path = $this->phpci->buildPath . $this->path;
|
||||
if (!empty($this->path) && $this->path{0} == '/') {
|
||||
$path = $this->path;
|
||||
}
|
||||
|
||||
$cmd = $phpmd . ' "%s" text %s %s %s';
|
||||
$success = $this->phpci->executeCommand(
|
||||
$cmd,
|
||||
$this->phpci->buildPath . $this->path,
|
||||
$path,
|
||||
implode(',', $this->rules),
|
||||
$ignore,
|
||||
$suffixes
|
||||
|
|
49
PHPCI/Plugin/Wipe.php
Normal file
49
PHPCI/Plugin/Wipe.php
Normal file
|
@ -0,0 +1,49 @@
|
|||
<?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;
|
||||
|
||||
use PHPCI\Builder;
|
||||
use PHPCI\Model\Build;
|
||||
|
||||
/**
|
||||
* Wipe Plugin - Wipes a folder
|
||||
* @author Claus Due <claus@namelesscoder.net>
|
||||
* @package PHPCI
|
||||
* @subpackage Plugins
|
||||
*/
|
||||
class Wipe implements \PHPCI\Plugin
|
||||
{
|
||||
protected $directory;
|
||||
protected $phpci;
|
||||
|
||||
public function __construct(Builder $phpci, Build $build, array $options = array())
|
||||
{
|
||||
$path = $phpci->buildPath;
|
||||
$this->phpci = $phpci;
|
||||
$this->directory = isset($options['directory']) ? $options['directory'] : $path;
|
||||
}
|
||||
|
||||
/**
|
||||
* Wipes a directory's contents
|
||||
*/
|
||||
public function execute()
|
||||
{
|
||||
$build = $this->phpci->buildPath;
|
||||
|
||||
if ($this->directory == $build || empty($this->directory)) {
|
||||
return true;
|
||||
}
|
||||
if (is_dir($this->directory)) {
|
||||
$cmd = 'rm -rf %s*';
|
||||
$success = $this->phpci->executeCommand($cmd, $this->directory);
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue