Compare commits

...

2 commits

Author SHA1 Message Date
Marco Vito Moscaritolo cfeeaa96b2 Plugin DocBlock clenaup. 2015-04-28 09:12:55 +02:00
Marco Vito Moscaritolo b8443b8af7 Plugin cleanup
* Renamed plugins interface (granted backcompatibility for external plugins)
 * Updated copyright in plugin
 * Dockblock cleanup
2015-04-28 08:50:09 +02:00
43 changed files with 629 additions and 346 deletions

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -10,10 +10,13 @@
namespace PHPCI;
/**
* PHPCI Plugin Interface - Used by all build plugins.
* @author Dan Cryer <dan@block8.co.uk>
*/
interface Plugin
* PHPCI Plugin Interface - Used by all build plugins.
*
* @author Dan Cryer <dan@block8.co.uk>
* @deprecated 1.8 Only for backward compatibility
* @see PluginInterface
*/
interface Plugin extends PluginInterface
{
public function execute();
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,12 +12,20 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Atoum plugin, runs Atoum tests within a project.
* @package PHPCI\Plugin
* Atoum plugin
*
* Runs Atoum tests within a project.
*
* @author Sanpi <sanpi@homecomputing.fr>
* @author André Cianfarani <acianfa@gmail.com>
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Atoum implements \PHPCI\Plugin
class Atoum implements PluginInterface
{
private $args;
private $config;
@ -25,6 +33,7 @@ class Atoum implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -54,8 +63,7 @@ class Atoum implements \PHPCI\Plugin
}
/**
* Run the Atoum plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{
@ -84,7 +92,7 @@ class Atoum implements \PHPCI\Plugin
$status = false;
$this->phpci->log(Lang::get('no_tests_performed'));
}
return $status;
}
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Behat BDD Plugin
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Behat implements \PHPCI\Plugin
class Behat implements PluginInterface
{
protected $phpci;
protected $build;
@ -55,7 +57,7 @@ class Behat implements \PHPCI\Plugin
}
/**
* Runs Behat tests.
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,15 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Campfire Plugin - Allows Campfire API actions.
* strongly based on icecube (http://labs.mimmin.com/icecube)
* Campfire Plugin
*
* Allows Campfire API actions, strongly based on icecube (http://labs.mimmin.com/icecube)
*
* @author André Cianfarani <acianfa@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Campfire implements \PHPCI\Plugin
class Campfire implements PluginInterface
{
private $url;
private $authToken;
@ -31,6 +34,7 @@ class Campfire implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -58,8 +62,7 @@ class Campfire implements \PHPCI\Plugin
}
/**
* Run the Campfire plugin.
* @return bool|mixed
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,15 +11,19 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Clean build removes Composer related files and allows PHPCI users to clean up their build directory.
* Useful as a precursor to copy_build.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class CleanBuild implements \PHPCI\Plugin
* Clean build Plugin
*
* Removes Composer related files and allows PHPCI users to clean up their build
* directory. Useful as a precursor to copy_build.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class CleanBuild implements PluginInterface
{
protected $remove;
protected $phpci;
@ -45,8 +49,8 @@ class CleanBuild implements \PHPCI\Plugin
}
/**
* Executes Composer and runs a specified command (e.g. install / update)
*/
* {@inheritDocs}
*/
public function execute()
{
$cmd = 'rm -Rf "%s"';
@ -57,7 +61,7 @@ class CleanBuild implements \PHPCI\Plugin
$this->phpci->executeCommand($cmd, $this->phpci->buildPath . 'composer.lock');
$success = true;
foreach ($this->remove as $file) {
$ok = $this->phpci->executeCommand($cmd, $this->phpci->buildPath . $file);

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -14,16 +14,21 @@ use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Plugin\Util\TestResultParsers\Codeception as Parser;
use Psr\Log\LogLevel;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* Codeception Plugin - Enables full acceptance, unit, and functional testing.
* Codeception Plugin
*
* Enables full acceptance, unit, and functional testing.
*
* @author Don Gilbert <don@dongilbert.net>
* @author Igor Timoshenko <contact@igortimoshenko.com>
* @author Adam Cooper <adam@networkpie.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
class Codeception implements PluginInterface, PluginZeroConfigInterface
{
/** @var string */
protected $args = '';
@ -45,10 +50,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
protected $path;
/**
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -61,7 +63,9 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
/**
* Try and find the codeception YML config file.
*
* @param $buildPath
*
* @return null|string
*/
public static function findConfigFile($buildPath)
@ -79,6 +83,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -104,7 +109,7 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
}
/**
* Runs Codeception tests, optionally using specified config file(s).
* {@inheritDocs}
*/
public function execute()
{
@ -123,8 +128,11 @@ class Codeception implements \PHPCI\Plugin, \PHPCI\ZeroConfigPlugin
/**
* Run tests from a Codeception config file.
*
* @param $configPath
*
* @return bool|mixed
*
* @throws \Exception
*/
protected function runConfigFile($configPath)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -13,14 +13,19 @@ use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Helper\Lang;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* Composer Plugin - Provides access to Composer functionality.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* Composer Plugin
*
* Provides access to Composer functionality.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Composer implements PluginInterface, PluginZeroConfigInterface
{
protected $directory;
protected $action;
@ -29,11 +34,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $build;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -48,6 +49,7 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -75,8 +77,8 @@ class Composer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Executes Composer and runs a specified command (e.g. install / update)
*/
* {@inheritDocs}
*/
public function execute()
{
$composerLocation = $this->phpci->findBinary(array('composer', 'composer.phar'));

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Helper\Lang;
use PHPCI\PluginInterface;
/**
* Copy Build Plugin - Copies the entire build to another directory.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class CopyBuild implements \PHPCI\Plugin
* Copy Build Plugin
*
* Copies the entire build to another directory.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class CopyBuild implements PluginInterface
{
protected $directory;
protected $ignore;
@ -29,6 +33,7 @@ class CopyBuild implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -44,8 +49,8 @@ class CopyBuild implements \PHPCI\Plugin
}
/**
* Copies files from the root of the build directory into the target folder
*/
* {@inheritDocs}
*/
public function execute()
{
$build = $this->phpci->buildPath;
@ -70,6 +75,7 @@ class CopyBuild implements \PHPCI\Plugin
/**
* Wipe the destination directory if it already exists.
*
* @throws \Exception
*/
protected function wipeExistingDirectory()

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -14,14 +14,18 @@ use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\Helper\Email as EmailHelper;
use PHPCI\PluginInterface;
/**
* Email Plugin - Provides simple email capability to PHPCI.
* @author Steve Brazier <meadsteve@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Email implements \PHPCI\Plugin
* Email Plugin
*
* Provides simple email capability to PHPCI.
*
* @author Steve Brazier <meadsteve@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Email implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -40,6 +44,7 @@ class Email implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param \Swift_Mailer $mailer
@ -56,7 +61,7 @@ class Email implements \PHPCI\Plugin
}
/**
* Send a notification mail.
* {@inheritDocs}
*/
public function execute()
{
@ -91,11 +96,14 @@ class Email implements \PHPCI\Plugin
}
/**
* @param string $toAddress Single address to send to
* @param string[] $ccList
* @param string $subject Email subject
* @param string $body Email body
* @return array Array of failed addresses
* Send a mail using the specified information.
*
* @param string $toAddress Single address to send to
* @param string[] $ccList List of user to CC
* @param string $subject Email subject
* @param string $body Email body
*
* @return array Array of failed addresses
*/
public function sendEmail($toAddress, $ccList, $subject, $body)
{
@ -118,14 +126,11 @@ class Email implements \PHPCI\Plugin
/**
* Send an email to a list of specified subjects.
*
* @param array $toAddresses
* List of destinatary of message.
* @param string $subject
* Mail subject
* @param string $body
* Mail body
* @param array $toAddresses List of destinatary of message.
* @param string $subject Mail subject
* @param string $body Mail body
*
* @return int number of failed messages
* @return int number of failed messages
*/
public function sendSeparateEmails(array $toAddresses, $subject, $body)
{
@ -142,6 +147,7 @@ class Email implements \PHPCI\Plugin
/**
* Get the list of email addresses to send to.
*
* @return array
*/
protected function getEmailAddresses()
@ -168,6 +174,7 @@ class Email implements \PHPCI\Plugin
/**
* Get the list of email addresses to CC.
*
* @return array
*/
protected function getCcAddresses()

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Environment variable plugin
* @author Steve Kamerman <stevekamerman@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Env implements \PHPCI\Plugin
* Environment variable plugin
*
* @author Steve Kamerman <stevekamerman@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Env implements PluginInterface
{
protected $phpci;
protected $build;
@ -27,6 +29,7 @@ class Env implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -39,8 +42,8 @@ class Env implements \PHPCI\Plugin
}
/**
* Adds the specified environment variables to the builder environment
*/
* {@inheritDocs}
*/
public function execute()
{
$success = true;
@ -52,7 +55,7 @@ class Env implements \PHPCI\Plugin
// This allows the standard syntax: "FOO: bar"
$env_var = "$key=$value";
}
if (!putenv($this->phpci->interpolate($env_var))) {
$success = false;
$this->phpci->logFailure(Lang::get('unable_to_set_env'));

View file

@ -0,0 +1,17 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Plugin\Exception;
use PHPCI\Plugin\Exception\PluginException;
class PluginBinaryNotFoundException extends PluginException
{
}

View file

@ -0,0 +1,17 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Plugin\Exception;
use Exception;
class PluginException extends Exception
{
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Git plugin.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Git implements \PHPCI\Plugin
class Git implements PluginInterface
{
protected $phpci;
protected $build;
@ -27,6 +29,7 @@ class Git implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -39,8 +42,7 @@ class Git implements \PHPCI\Plugin
}
/**
* Run the Git plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{
@ -70,8 +72,10 @@ class Git implements \PHPCI\Plugin
/**
* Determine which action to run, and run it.
*
* @param $action
* @param array $options
*
* @return bool
*/
protected function runAction($action, array $options = array())
@ -96,6 +100,7 @@ class Git implements \PHPCI\Plugin
/**
* Handle a merge action.
*
* @param $options
* @return bool
*/
@ -110,6 +115,7 @@ class Git implements \PHPCI\Plugin
/**
* Handle a tag action.
*
* @param $options
* @return bool
*/
@ -132,6 +138,7 @@ class Git implements \PHPCI\Plugin
/**
* Handle a pull action.
*
* @param $options
* @return bool
*/
@ -153,6 +160,7 @@ class Git implements \PHPCI\Plugin
/**
* Handle a push action.
*
* @param $options
* @return bool
*/

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,14 +11,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Grunt Plugin - Provides access to grunt functionality.
* @author Tobias Tom <t.tom@succont.de>
* @package PHPCI
* @subpackage Plugins
*/
class Grunt implements \PHPCI\Plugin
* Grunt Plugin
*
* Provides access to grunt functionality.
*
* @author Tobias Tom <t.tom@succont.de>
* @package PHPCI
* @subpackage Plugins
*/
class Grunt implements PluginInterface
{
protected $directory;
protected $task;
@ -69,8 +73,8 @@ class Grunt implements \PHPCI\Plugin
}
/**
* Executes grunt and runs a specified command (e.g. install / update)
*/
* {@inheritDocs}
*/
public function execute()
{
// if npm does not work, we cannot use grunt, so we return false

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,14 +11,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Gulp Plugin - Provides access to gulp functionality.
* @author Dirk Heilig <dirk@heilig-online.com>
* @package PHPCI
* @subpackage Plugins
*/
class Gulp implements \PHPCI\Plugin
* Gulp Plugin
*
* Provides access to gulp functionality.
*
* @author Dirk Heilig <dirk@heilig-online.com>
* @package PHPCI
* @subpackage Plugins
*/
class Gulp implements PluginInterface
{
protected $directory;
protected $task;
@ -69,8 +73,8 @@ class Gulp implements \PHPCI\Plugin
}
/**
* Executes gulp and runs a specified command (e.g. install / update)
*/
* {@inheritDocs}
*/
public function execute()
{
// if npm does not work, we cannot use gulp, so we return false

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Hipchat Plugin
* Hipchat Plugin.
*
* Send build notification in HipChat.
*
* @author James Inman <james@jamesinman.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class HipchatNotify implements \PHPCI\Plugin
class HipchatNotify implements PluginInterface
{
protected $authToken;
protected $color;
@ -27,9 +31,11 @@ class HipchatNotify implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
*
* @throws \Exception
*/
public function __construct(Builder $phpci, Build $build, array $options = array())
@ -68,8 +74,7 @@ class HipchatNotify implements \PHPCI\Plugin
}
/**
* Run the HipChat plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* IRC Plugin - Sends a notification to an IRC channel
* IRC Plugin
*
* Sends a notification to an IRC channel.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Irc implements \PHPCI\Plugin
class Irc implements PluginInterface
{
protected $phpci;
protected $build;
@ -61,8 +65,7 @@ class Irc implements \PHPCI\Plugin
}
/**
* Run IRC plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{
@ -93,8 +96,11 @@ class Irc implements \PHPCI\Plugin
}
/**
* Execute a list of IRC commands.
*
* @param resource $socket
* @param array $commands
*
* @return bool
*/
private function executeIrcCommands($socket, array $commands)
@ -120,9 +126,11 @@ class Irc implements \PHPCI\Plugin
}
/**
* Execute a single IRC command.
*
* @param resource $socket
* @param string $command
*
* @return bool
*/
private function executeIrcCommand($socket, $command)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PHP Lint Plugin - Provides access to PHP lint functionality.
* PHP Lint Plugin
*
* Provides access to PHP lint functionality.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Lint implements PHPCI\Plugin
class Lint implements PluginInterface
{
protected $directories;
protected $recursive = true;
@ -60,7 +64,7 @@ class Lint implements PHPCI\Plugin
}
/**
* Executes parallel lint
* {@inheritDocs}
*/
public function execute()
{
@ -82,9 +86,11 @@ class Lint implements PHPCI\Plugin
/**
* Lint an item (file or directory) by calling the appropriate method.
*
* @param $php
* @param $item
* @param $itemPath
*
* @return bool
*/
protected function lintItem($php, $item, $itemPath)
@ -102,8 +108,10 @@ class Lint implements PHPCI\Plugin
/**
* Run php -l against a directory of files.
*
* @param $php
* @param $path
*
* @return bool
*/
protected function lintDirectory($php, $path)
@ -132,8 +140,10 @@ class Lint implements PHPCI\Plugin
/**
* Run php -l against a specific file.
*
* @param $php
* @param $path
*
* @return bool
*/
protected function lintFile($php, $path)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -13,15 +13,19 @@ use PDO;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* MySQL Plugin - Provides access to a MySQL database.
* @author Dan Cryer <dan@block8.co.uk>
* @author Steve Kamerman <stevekamerman@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Mysql implements \PHPCI\Plugin
* MySQL Plugin
*
* Provides access to a MySQL database.
*
* @author Dan Cryer <dan@block8.co.uk>
* @author Steve Kamerman <stevekamerman@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Mysql implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -91,9 +95,8 @@ class Mysql implements \PHPCI\Plugin
}
/**
* Connects to MySQL and runs a specified set of queries.
* @return boolean
*/
* {@inheritDocs}
*/
public function execute()
{
try {
@ -120,7 +123,9 @@ class Mysql implements \PHPCI\Plugin
/**
* @param string $query
*
* @return boolean
*
* @throws \Exception
*/
protected function executeFile($query)
@ -146,8 +151,10 @@ class Mysql implements \PHPCI\Plugin
/**
* Builds the MySQL import command required to import/execute the specified file
*
* @param string $import_file Path to file, relative to the build root
* @param string $database If specified, this database is selected before execution
* @param string $database If specified, this database is selected before execution
*
* @return string
*/
protected function getImportCommand($import_file, $database = null)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,14 +11,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Create a ZIP or TAR.GZ archive of the entire build.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PackageBuild implements \PHPCI\Plugin
* Create a ZIP or TAR.GZ archive of the entire build.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PackageBuild implements PluginInterface
{
protected $directory;
protected $filename;
@ -27,6 +29,7 @@ class PackageBuild implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -42,8 +45,8 @@ class PackageBuild implements \PHPCI\Plugin
}
/**
* Executes Composer and runs a specified command (e.g. install / update)
*/
* {@inheritDocs}
*/
public function execute()
{
$path = $this->phpci->buildPath;

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Pdepend Plugin - Allows Pdepend report
* Pdepend Plugin
*
* Allows Pdepend report
*
* @author Johan van der Heide <info@japaveh.nl>
* @package PHPCI
* @subpackage Plugins
*/
class Pdepend implements \PHPCI\Plugin
class Pdepend implements PluginInterface
{
protected $args;
/**
@ -50,6 +54,7 @@ class Pdepend implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -69,7 +74,7 @@ class Pdepend implements \PHPCI\Plugin
}
/**
* Runs Pdepend with the given criteria as arguments
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PDO;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PgSQL Plugin - Provides access to a PgSQL database.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Pgsql implements \PHPCI\Plugin
* PgSQL Plugin
*
* Provides access to a PgSQL database.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class Pgsql implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -73,9 +77,8 @@ class Pgsql implements \PHPCI\Plugin
}
/**
* Connects to PgSQL and runs a specified set of queries.
* @return boolean
*/
* {@inheritDocs}
*/
public function execute()
{
try {

View file

@ -1,16 +1,31 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI\Plugin;
use Exception;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use Phar as PHPPhar;
/**
* Phar Plugin
*
* Plugin to generate php package using phar format.
*
* @author Wanderson <wandersonwhcr@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Phar implements \PHPCI\Plugin
class Phar implements PluginInterface
{
/**
* PHPCI
@ -111,6 +126,7 @@ class Phar implements \PHPCI\Plugin
* Directory Setter
*
* @param string $directory Configuration Value
*
* @return Phar Fluent Interface
*/
public function setDirectory($directory)
@ -136,6 +152,7 @@ class Phar implements \PHPCI\Plugin
* Filename Setter
*
* @param string $filename Configuration Value
*
* @return Phar Fluent Interface
*/
public function setFilename($filename)
@ -161,6 +178,7 @@ class Phar implements \PHPCI\Plugin
* Regular Expression Setter
*
* @param string $regexp Configuration Value
*
* @return Phar Fluent Interface
*/
public function setRegExp($regexp)
@ -186,6 +204,7 @@ class Phar implements \PHPCI\Plugin
* Stub Filename Setter
*
* @param string $stub Configuration Value
*
* @return Phar Fluent Interface
*/
public function setStub($stub)
@ -206,6 +225,7 @@ class Phar implements \PHPCI\Plugin
/**
* Get stub content for the Phar file.
*
* @return string
*/
public function getStubContent()
@ -219,8 +239,7 @@ class Phar implements \PHPCI\Plugin
}
/**
* Run the phar plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,15 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Phing Plugin - Provides access to Phing functionality.
* Phing Plugin
*
* Provides access to Phing functionality.
*
* @author Pavel Pavlov <ppavlov@alera.ru>
* @package PHPCI
* @subpackage Plugins
*/
class Phing implements \PHPCI\Plugin
class Phing implements PluginInterface
{
private $directory;
@ -34,6 +37,7 @@ class Phing implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -43,9 +47,7 @@ class Phing implements \PHPCI\Plugin
$this->setPhpci($phpci);
$this->build = $build;
/*
* Set working directory
*/
// Set working directory
if (isset($options['directory'])) {
$directory = $phpci->buildPath . '/' . $options['directory'];
} else {
@ -54,9 +56,7 @@ class Phing implements \PHPCI\Plugin
$this->setDirectory($directory);
/*
* Sen name of a non default build file
*/
// Set name of a non default build file
if (isset($options['build_file'])) {
$this->setBuildFile($options['build_file']);
}
@ -75,7 +75,7 @@ class Phing implements \PHPCI\Plugin
}
/**
* Executes Phing and runs a specified targets
* {@inheritDocs}
*/
public function execute()
{
@ -97,7 +97,7 @@ class Phing implements \PHPCI\Plugin
}
/**
* @return \PHPCI\Builder
* @return Builder
*/
public function getPhpci()
{
@ -105,7 +105,7 @@ class Phing implements \PHPCI\Plugin
}
/**
* @param \PHPCI\Builder $phpci
* @param Builder $phpci
*
* @return $this
*/
@ -142,6 +142,7 @@ class Phing implements \PHPCI\Plugin
/**
* Converts an array of targets into a string.
*
* @return string
*/
private function targetsToString()
@ -175,6 +176,7 @@ class Phing implements \PHPCI\Plugin
* @param mixed $buildFile
*
* @return $this
*
* @throws \Exception
*/
public function setBuildFile($buildFile)
@ -188,6 +190,7 @@ class Phing implements \PHPCI\Plugin
/**
* Get phing build file path.
*
* @return string
*/
public function getBuildFilePath()
@ -208,10 +211,8 @@ class Phing implements \PHPCI\Plugin
*/
public function propertiesToString()
{
/**
* fix the problem when execute phing out of the build dir
* @ticket 748
*/
// Fix the problem when execute phing out of the build dir
// @ticket 748
if (!isset($this->properties['project.basedir'])) {
$this->properties['project.basedir'] = $this->getDirectory();
}
@ -251,6 +252,7 @@ class Phing implements \PHPCI\Plugin
* @param string $propertyFile
*
* @return $this
*
* @throws \Exception
*/
public function setPropertyFile($propertyFile)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,19 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* PHP Code Sniffer Plugin - Allows PHP Code Sniffer testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* PHP Code Sniffer Plugin
*
* Allows PHP Code Sniffer testing.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCodeSniffer implements PluginInterface, PluginZeroConfigInterface
{
/**
* @var \PHPCI\Builder
@ -73,11 +78,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $ignore;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -129,6 +130,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Handle this plugin's options.
*
* @param $options
*/
protected function setOptions($options)
@ -141,8 +143,8 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs PHP Code Sniffer in a specified directory, to a specified standard.
*/
* {@inheritDocs}
*/
public function execute()
{
list($ignore, $standard, $suffixes) = $this->getFlags();
@ -185,6 +187,7 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Process options and produce an arguments string for PHPCS.
*
* @return array
*/
protected function getFlags()
@ -210,8 +213,11 @@ class PhpCodeSniffer implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Process the PHPCS output report.
*
* @param $output
*
* @return array
*
* @throws \Exception
*/
protected function processReport($output)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PHP Copy / Paste Detector - Allows PHP Copy / Paste Detector testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCpd implements \PHPCI\Plugin
* PHP Copy / Paste Detector.
*
* Allows PHP Copy / Paste Detector testing.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCpd implements PluginInterface
{
protected $directory;
protected $args;
@ -39,6 +43,7 @@ class PhpCpd implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -66,8 +71,8 @@ class PhpCpd implements \PHPCI\Plugin
}
/**
* Runs PHP Copy/Paste Detector in a specified directory.
*/
* {@inheritDocs}
*/
public function execute()
{
$ignore = '';
@ -108,8 +113,11 @@ class PhpCpd implements \PHPCI\Plugin
/**
* Process the PHPCPD XML report.
*
* @param $xmlString
*
* @return array
*
* @throws \Exception
*/
protected function processReport($xmlString)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,18 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PHP CS Fixer - Works with the PHP CS Fixer for testing coding standards.
* @author Gabriel Baker <gabriel@autonomicpilot.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCsFixer implements \PHPCI\Plugin
* PHP CS Fixer
*
* Works with the PHP CS Fixer for testing coding standards.
*
* @author Gabriel Baker <gabriel@autonomicpilot.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpCsFixer implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -59,8 +63,7 @@ class PhpCsFixer implements \PHPCI\Plugin
}
/**
* Run PHP CS Fixer.
* @return bool
* {@inheritDocs}
*/
public function execute()
{
@ -79,6 +82,7 @@ class PhpCsFixer implements \PHPCI\Plugin
/**
* Build an args string for PHPCS Fixer.
*
* @param $options
*/
public function buildArgs($options)
@ -98,6 +102,5 @@ class PhpCsFixer implements \PHPCI\Plugin
if (isset($options['workingdir']) && $options['workingdir']) {
$this->workingdir = $this->phpci->buildPath . $options['workingdir'];
}
}
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,19 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* PHP Docblock Checker Plugin - Checks your PHP files for appropriate uses of Docblocks
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* PHP Docblock Checker Plugin
*
* Checks your PHP files for appropriate uses of Docblocks.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpDocblockChecker implements PluginInterface, PluginZeroConfigInterface
{
/**
* @var \PHPCI\Builder
@ -46,11 +51,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $skipMethods = false;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -63,6 +64,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -97,7 +99,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs PHP Mess Detector in a specified directory.
* {@inheritDocs}
*/
public function execute()
{
@ -155,6 +157,7 @@ class PhpDocblockChecker implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Report all of the errors we've encountered line-by-line.
*
* @param $output
*/
protected function reportErrors($output)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,30 +12,30 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* PHP Loc - Allows PHP Copy / Lines of Code testing.
*
* @author Johan van der Heide <info@japaveh.nl>
* @package PHPCI
* @subpackage Plugins
*/
class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
class PhpLoc implements PluginInterface, PluginZeroConfigInterface
{
/**
* @var string
*/
protected $directory;
/**
* @var \PHPCI\Builder
*/
protected $phpci;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -48,6 +48,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -64,7 +65,7 @@ class PhpLoc implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs PHP Copy/Paste Detector in a specified directory.
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,17 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* PHP Mess Detector Plugin - Allows PHP Mess Detector testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* PHP Mess Detector Plugin - Allows PHP Mess Detector testing.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpMessDetector implements PluginInterface, PluginZeroConfigInterface
{
/**
* @var \PHPCI\Builder
@ -56,11 +59,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $rules;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -111,7 +110,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs PHP Mess Detector in a specified directory.
* {@inheritDocs}
*/
public function execute()
{
@ -132,6 +131,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Override a default setting.
*
* @param $options
* @param $key
*/
@ -144,8 +144,11 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Process PHPMD's XML output report.
*
* @param $xmlString
*
* @return array
*
* @throws \Exception
*/
protected function processReport($xmlString)
@ -186,6 +189,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Try and process the rules parameter from phpci.yml.
*
* @return bool
*/
protected function tryAndProcessRules()
@ -206,6 +210,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Execute PHP Mess Detector.
*
* @param $binaryPath
*/
protected function executePhpMd($binaryPath)
@ -242,6 +247,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Get the path PHPMD should be run against.
*
* @return string
*/
protected function getTargetPath()
@ -258,6 +264,7 @@ class PhpMessDetector implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* Returns a boolean indicating if the error count can be considered a success.
*
* @param int $errorCount
*
* @return bool
*/
protected function wasLastExecSuccessful($errorCount)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Php Parallel Lint Plugin - Provides access to PHP lint functionality.
* @author Vaclav Makes <vaclav@makes.cz>
* @package PHPCI
* @subpackage Plugins
*/
class PhpParallelLint implements \PHPCI\Plugin
* Php Parallel Lint Plugin - Provides access to PHP lint functionality.
*
* @author Vaclav Makes <vaclav@makes.cz>
* @package PHPCI
* @subpackage Plugins
*/
class PhpParallelLint implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -70,8 +72,8 @@ class PhpParallelLint implements \PHPCI\Plugin
}
/**
* Executes parallel lint
*/
* {@inheritDocs}
*/
public function execute()
{
list($ignore) = $this->getFlags();
@ -97,6 +99,7 @@ class PhpParallelLint implements \PHPCI\Plugin
/**
* Produce an argument string for PHP Parallel Lint.
*
* @return array
*/
protected function getFlags()

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,22 +12,24 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PHP Spec Plugin - Allows PHP Spec testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpSpec implements PHPCI\Plugin
* PHP Spec Plugin - Allows PHP Spec testing.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpSpec implements PluginInterface
{
/**
* @var \PHPCI\Builder
* @var Builder
*/
protected $phpci;
/**
* @var \PHPCI\Model\Build
* @var Build
*/
protected $build;
@ -38,6 +40,7 @@ class PhpSpec implements PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -50,8 +53,8 @@ class PhpSpec implements PHPCI\Plugin
}
/**
* Runs PHP Spec tests.
*/
* {@inheritDocs}
*/
public function execute()
{
$curdir = getcwd();
@ -143,7 +146,6 @@ class PhpSpec implements PHPCI\Plugin
$this->build->storeMeta('phpspec', $data);
return $success;
}
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* PHPTAL Lint Plugin - Provides access to PHPTAL lint functionality.
*
* @author Stephen Ball <phpci@stephen.rebelinblue.com>
* @package PHPCI
* @subpackage Plugins
*/
class PhpTalLint implements PHPCI\Plugin
class PhpTalLint implements PluginInterface
{
protected $directories;
protected $recursive = true;
@ -27,12 +29,12 @@ class PhpTalLint implements PHPCI\Plugin
protected $ignore;
/**
* @var \PHPCI\Builder
* @var Builder
*/
protected $phpci;
/**
* @var \PHPCI\Model\Build
* @var Build
*/
protected $build;
@ -87,6 +89,7 @@ class PhpTalLint implements PHPCI\Plugin
/**
* Handle this plugin's options.
*
* @param $options
*/
protected function setOptions($options)
@ -99,7 +102,7 @@ class PhpTalLint implements PHPCI\Plugin
}
/**
* Executes phptal lint
* {@inheritDocs}
*/
public function execute()
{
@ -143,8 +146,10 @@ class PhpTalLint implements PHPCI\Plugin
/**
* Lint an item (file or directory) by calling the appropriate method.
*
* @param $item
* @param $itemPath
*
* @return bool
*/
protected function lintItem($item, $itemPath)
@ -164,7 +169,9 @@ class PhpTalLint implements PHPCI\Plugin
/**
* Run phptal lint against a directory of files.
*
* @param $path
*
* @return bool
*/
protected function lintDirectory($path)
@ -193,7 +200,9 @@ class PhpTalLint implements PHPCI\Plugin
/**
* Run phptal lint against a specific file.
*
* @param $path
*
* @return bool
*/
protected function lintFile($path)
@ -222,7 +231,7 @@ class PhpTalLint implements PHPCI\Plugin
$row = str_replace('(use -i to include your custom modifier functions)', '', $row);
$message = str_replace($name . ': ', '', $row);
$parts = explode(' (line ', $message);
$message = trim($parts[0]);
@ -244,6 +253,7 @@ class PhpTalLint implements PHPCI\Plugin
/**
* Process options and produce an arguments string for PHPTAL Lint.
*
* @return array
*/
protected function getFlags()

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -13,14 +13,17 @@ use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\Plugin\Util\TapParser;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* PHP Unit Plugin - Allows PHP Unit testing.
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* PHP Unit Plugin - Allows PHP Unit testing.
*
* @author Dan Cryer <dan@block8.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class PhpUnit implements PluginInterface, PluginZeroConfigInterface
{
protected $args;
protected $phpci;
@ -50,11 +53,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
protected $xmlConfigFile;
/**
* Check if this plugin can be executed.
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -67,7 +66,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Try and find the phpunit XML config file.
*
* @param $buildPath
*
* @return null|string
*/
public static function findConfigFile($buildPath)
@ -138,8 +139,8 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs PHP Unit tests in a specified directory, optionally using specified config file(s).
*/
* {@inheritDocs}
*/
public function execute()
{
if (empty($this->xmlConfigFile) && empty($this->directory)) {
@ -184,7 +185,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Run the tests defined in a PHPUnit config file.
*
* @param $configPath
*
* @return bool|mixed
*/
protected function runConfigFile($configPath)
@ -212,7 +215,9 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Run the PHPUnit tests in a specific directory or array of directories.
*
* @param $directory
*
* @return bool|mixed
*/
protected function runDir($directory)
@ -235,6 +240,7 @@ class PhpUnit implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* @param $array
* @param $callable
*
* @return bool|mixed
*/
protected function recurseArg($array, $callable)

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Helper\Lang;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Shell Plugin - Allows execute shell commands.
*
* @author Kinn Coelho Julião <kinncj@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Shell implements \PHPCI\Plugin
class Shell implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -75,7 +77,7 @@ class Shell implements \PHPCI\Plugin
}
/**
* Runs the shell command.
* {@inheritDocs}
*/
public function execute()
{

View file

@ -1,7 +1,8 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
* @copyright Copyright 2014, Block 8 Limited.
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -10,14 +11,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Slack Plugin
*
* @author Stephen Ball <phpci@stephen.rebelinblue.com>
* @package PHPCI
* @subpackage Plugins
*/
class SlackNotify implements \PHPCI\Plugin
class SlackNotify implements PluginInterface
{
private $webHook;
private $room;
@ -69,8 +72,7 @@ class SlackNotify implements \PHPCI\Plugin
}
/**
* Run the Slack plugin.
* @return bool
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,14 +12,16 @@ namespace PHPCI\Plugin;
use PDO;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* SQLite Plugin Provides access to a SQLite database.
* @author Corpsee <poisoncorpsee@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Sqlite implements \PHPCI\Plugin
* SQLite Plugin Provides access to a SQLite database.
*
* @author Corpsee <poisoncorpsee@gmail.com>
* @package PHPCI
* @subpackage Plugins
*/
class Sqlite implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -60,8 +62,7 @@ class Sqlite implements \PHPCI\Plugin
}
/**
* Connects to SQLite and runs a specified set of queries.
* @return boolean
* {@inheritDocs}
*/
public function execute()
{

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -12,15 +12,17 @@ namespace PHPCI\Plugin;
use PHPCI;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
use PHPCI\PluginZeroConfigInterface;
/**
* Technical Debt Plugin - Checks for existence of "TODO", "FIXME", etc.
*
* @author James Inman <james@jamesinman.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
* Technical Debt Plugin - Checks for existence of "TODO", "FIXME", etc.
*
* @author James Inman <james@jamesinman.co.uk>
* @package PHPCI
* @subpackage Plugins
*/
class TechnicalDebt implements PluginInterface, PluginZeroConfigInterface
{
/**
* @var \PHPCI\Builder
@ -65,12 +67,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Check if this plugin can be executed.
*
* @param $stage
* @param Builder $builder
* @param Build $build
* @return bool
* {@inheritDocs}
*/
public static function canExecute($stage, Builder $builder, Build $build)
{
@ -110,6 +107,7 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
/**
* Handle this plugin's options.
*
* @param $options
*/
protected function setOptions($options)
@ -122,8 +120,8 @@ class TechnicalDebt implements PHPCI\Plugin, PHPCI\ZeroConfigPlugin
}
/**
* Runs the plugin
*/
* {@inheritDocs}
*/
public function execute()
{
$success = true;

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,14 +11,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* Wipe Plugin - Wipes a folder
* @author Claus Due <claus@namelesscoder.net>
* @package PHPCI
* @subpackage Plugins
*/
class Wipe implements \PHPCI\Plugin
* Wipe Plugin - Wipes a folder
*
* @author Claus Due <claus@namelesscoder.net>
* @package PHPCI
* @subpackage Plugins
*/
class Wipe implements PluginInterface
{
/**
* @var \PHPCI\Builder
@ -34,6 +36,7 @@ class Wipe implements \PHPCI\Plugin
/**
* Set up the plugin, configure options, etc.
*
* @param Builder $phpci
* @param Build $build
* @param array $options
@ -47,8 +50,8 @@ class Wipe implements \PHPCI\Plugin
}
/**
* Wipes a directory's contents
*/
* {@inheritDocs}
*/
public function execute()
{
$build = $this->phpci->buildPath;

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -11,14 +11,16 @@ namespace PHPCI\Plugin;
use PHPCI\Builder;
use PHPCI\Model\Build;
use PHPCI\PluginInterface;
/**
* XMPP Notification - Send notification for successful or failure build
* @author Alexandre Russo <dev.github@ange7.com>
* @package PHPCI
* @subpackage Plugins
*/
class XMPP implements \PHPCI\Plugin
* XMPP Notification - Send notification for successful or failure build
*
* @author Alexandre Russo <dev.github@ange7.com>
* @package PHPCI
* @subpackage Plugins
*/
class XMPP implements PluginInterface
{
protected $directory;
protected $phpci;
@ -129,6 +131,8 @@ class XMPP implements \PHPCI\Plugin
/**
* Find config file for sendxmpp binary (default is .sendxmpprc)
*
* @return bool|null
*/
public function findConfigFile()
{
@ -144,8 +148,8 @@ class XMPP implements \PHPCI\Plugin
}
/**
* Send notification message.
*/
* {@inheritDocs}
*/
public function execute()
{
$sendxmpp = $this->phpci->findBinary('sendxmpp');
@ -199,6 +203,7 @@ class XMPP implements \PHPCI\Plugin
/**
* @param $message_file
*
* @return int
*/
protected function buildMessage($message_file)

32
PHPCI/PluginInterface.php Normal file
View file

@ -0,0 +1,32 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI;
use PHPCI\Plugin\Exception\PluginException;
use PHPCI\Plugin\Exception\PluginBinaryNotFoundException;
/**
* PHPCI Plugin Interface
*
* Interface used by all build plugins.
*
* @author Dan Cryer <dan@block8.co.uk>
*/
interface PluginInterface
{
/**
* Exeucte the plugin and return the execution success result.
*
* @return bool Plugin execution status result.
* @throws PluginException
* @throws PluginBinaryNotFoundException
*/
public function execute();
}

View file

@ -0,0 +1,30 @@
<?php
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
namespace PHPCI;
use PHPCI\Model\Build;
/**
* PHPCI Plugin Interface - Used by all build plugins.
*
* @author Dan Cryer <dan@block8.co.uk>
*/
interface PluginZeroConfigInterface
{
/**
* Check if this plugin can be executed.
*
* @param string $stage The current stage
* @param Builder $builder The plugin builder
* @param Build $build The current build
* @return bool Plugin execution result status.
*/
public static function canExecute($stage, Builder $builder, Build $build);
}

View file

@ -2,7 +2,7 @@
/**
* PHPCI - Continuous Integration for PHP
*
* @copyright Copyright 2014, Block 8 Limited.
* @copyright Copyright 2015, Block 8 Limited.
* @license https://github.com/Block8/PHPCI/blob/master/LICENSE.md
* @link https://www.phptesting.org/
*/
@ -13,9 +13,12 @@ use PHPCI\Model\Build;
/**
* PHPCI Plugin Interface - Used by all build plugins.
* @author Dan Cryer <dan@block8.co.uk>
*
* @author Dan Cryer <dan@block8.co.uk>
* @deprecated 1.8 Only for backward compatibility
* @see PluginZeroConfigInterface
*/
interface ZeroConfigPlugin
interface ZeroConfigPlugin extends PluginZeroConfigInterface
{
public static function canExecute($stage, Builder $builder, Build $build);
}