Renaming canExecute() to canRunZeroConfig() to avoid confusion with isAllowedInStage()
This commit is contained in:
parent
29a6c9767a
commit
e437e9b855
|
@ -168,7 +168,7 @@ class Build extends BuildBase
|
|||
}
|
||||
|
||||
foreach (array('setup', 'test', 'complete', 'success', 'failure') as $stage) {
|
||||
if ($className::canExecute($stage, $builder, $this)) {
|
||||
if ($className::canRunZeroConfig($stage, $builder, $this)) {
|
||||
$config[$stage][$className] = array(
|
||||
'zero_config' => true
|
||||
);
|
||||
|
|
|
@ -9,12 +9,16 @@
|
|||
|
||||
namespace PHPCI;
|
||||
|
||||
use PHPCI\Builder;
|
||||
use PHPCI\Model\Build;
|
||||
|
||||
/**
|
||||
* PHPCI Plugin Interface - Used by all build plugins.
|
||||
* @author Dan Cryer <dan@block8.co.uk>
|
||||
*/
|
||||
interface Plugin
|
||||
{
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build);
|
||||
public function isAllowedInStage($stage);
|
||||
public function execute();
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
namespace PHPCI\Plugin;
|
||||
|
||||
use PHPCI\Builder;
|
||||
use PHPCI\Model\Build;
|
||||
use PHPCI\Plugin;
|
||||
|
||||
/**
|
||||
|
@ -12,7 +14,7 @@ abstract class AbstractPlugin implements Plugin
|
|||
{
|
||||
/**
|
||||
* Define the stages that this plugin is allowed to run in.
|
||||
* @see AbstractPlugin::canExecute()
|
||||
* @see AbstractPlugin::isAllowedInStage()
|
||||
* @var array
|
||||
*/
|
||||
protected $allowedStages = array('setup', 'test', 'complete', 'success', 'failure', 'fixed', 'broken');
|
||||
|
@ -27,6 +29,19 @@ abstract class AbstractPlugin implements Plugin
|
|||
return in_array($stage, $this->allowedStages);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check whether or not this plugin can execute in zero config mode.
|
||||
* Many plugins will check if their required config files can be found here.
|
||||
* @param string $stage
|
||||
* @param Builder $builder
|
||||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the plugin and return its success or failure.
|
||||
* @return bool
|
||||
|
|
|
@ -56,7 +56,7 @@ class Codeception extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
return $stage == 'test' && !is_null(self::findConfigFile($builder->buildPath));
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class Composer extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
$path = $builder->buildPath . DIRECTORY_SEPARATOR . 'composer.json';
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ class PhpCodeSniffer extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test') {
|
||||
return true;
|
||||
|
|
|
@ -58,7 +58,7 @@ class PhpDocblockChecker extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test') {
|
||||
return true;
|
||||
|
|
|
@ -38,7 +38,7 @@ class PhpLoc extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test') {
|
||||
return true;
|
||||
|
|
|
@ -68,7 +68,7 @@ class PhpMessDetector extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test') {
|
||||
return true;
|
||||
|
|
|
@ -62,7 +62,7 @@ class PhpUnit extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test' && !is_null(self::findConfigFile($builder->buildPath))) {
|
||||
return true;
|
||||
|
|
|
@ -73,7 +73,7 @@ class TechnicalDebt extends AbstractPlugin implements ZeroConfigPlugin
|
|||
* @param Build $build
|
||||
* @return bool
|
||||
*/
|
||||
public static function canExecute($stage, Builder $builder, Build $build)
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build)
|
||||
{
|
||||
if ($stage == 'test') {
|
||||
return true;
|
||||
|
|
|
@ -17,5 +17,5 @@ use PHPCI\Model\Build;
|
|||
*/
|
||||
interface ZeroConfigPlugin
|
||||
{
|
||||
public static function canExecute($stage, Builder $builder, Build $build);
|
||||
public static function canRunZeroConfig($stage, Builder $builder, Build $build);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue