Renamed projects types and build classes: 'remote'/RemoteGitBuild to

'git'/GitBuild, MercurialBuild to HgBuild, SubversionBuild to SvnBuild,
'bitbuckethg' to 'bitbucket-hg'.
This commit is contained in:
Dmitry Khomutov 2018-02-28 10:00:10 +07:00
commit 58f1004652
No known key found for this signature in database
GPG key ID: EC19426474B37AAC
10 changed files with 41 additions and 23 deletions

View file

@ -7,7 +7,7 @@ use PHPCensor\Model\Build;
/**
* BuildFactory - Takes in a generic "Build" and returns a type-specific build model.
*
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class BuildFactory
@ -43,33 +43,33 @@ class BuildFactory
if (!empty($project)) {
switch ($project->getType()) {
case 'remote':
$type = 'RemoteGitBuild';
break;
case 'local':
$type = 'LocalBuild';
break;
case 'git':
$type = 'GitBuild';
break;
case 'github':
$type = 'GithubBuild';
break;
case 'bitbucket':
$type = 'BitbucketBuild';
break;
case 'bitbuckethg':
$type = 'BitbucketHgBuild';
break;
case 'gitlab':
$type = 'GitlabBuild';
break;
case 'hg':
$type = 'MercurialBuild';
break;
case 'svn':
$type = 'SubversionBuild';
break;
case 'gogs':
$type = 'GogsBuild';
break;
case 'hg':
$type = 'HgBuild';
break;
case 'bitbucket-hg':
$type = 'BitbucketHgBuild';
break;
case 'svn':
$type = 'SvnBuild';
break;
default:
return $build;
}

View file

@ -0,0 +1,18 @@
<?php
use Phinx\Migration\AbstractMigration;
class RenamedBuildTypes extends AbstractMigration
{
public function up()
{
$this->execute("UPDATE project SET type = 'git' WHERE type = 'remote'");
$this->execute("UPDATE project SET type = 'bitbucket-hg' WHERE type = 'bitbuckethg'");
}
public function down()
{
$this->execute("UPDATE project SET type = 'remote' WHERE type = 'git'");
$this->execute("UPDATE project SET type = 'bitbuckethg' WHERE type = 'bitbucket-hg'");
}
}

View file

@ -15,7 +15,7 @@ use PHPCensor\Model\BuildError;
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class BitbucketBuild extends RemoteGitBuild
class BitbucketBuild extends GitBuild
{
/**
* Get link to commit from another source (i.e. BitBucket)

View file

@ -9,7 +9,7 @@ use PHPCensor\Model\Build;
*
* @author Artem Bochkov <artem.v.bochkov@gmail.com>
*/
class BitbucketHgBuild extends MercurialBuild
class BitbucketHgBuild extends HgBuild
{
/**
* Get link to commit from another source (i.e. BitBucket)

View file

@ -11,7 +11,7 @@ use Psr\Log\LogLevel;
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class RemoteGitBuild extends Build
class GitBuild extends Build
{
/**
* Get the URL to be used to clone this remote repository.

View file

@ -15,7 +15,7 @@ use PHPCensor\Model\BuildError;
*
* @author Dan Cryer <dan@block8.co.uk>
*/
class GithubBuild extends RemoteGitBuild
class GithubBuild extends GitBuild
{
/**
* Get link to commit from another source (i.e. Github)

View file

@ -4,10 +4,10 @@ namespace PHPCensor\Model\Build;
/**
* Gitlab Build Model
*
*
* @author André Cianfarani <a.cianfarani@c2is.fr>
*/
class GitlabBuild extends RemoteGitBuild
class GitlabBuild extends GitBuild
{
/**

View file

@ -5,7 +5,7 @@ namespace PHPCensor\Model\Build;
/**
* GogsBuild Build Model
*/
class GogsBuild extends RemoteGitBuild
class GogsBuild extends GitBuild
{
/**
* Get link to commit from Gogs repository

View file

@ -10,7 +10,7 @@ use PHPCensor\Builder;
*
* @author Pavel Gopanenko <pavelgopanenko@gmail.com>
*/
class MercurialBuild extends Build
class HgBuild extends Build
{
/**
* Get the URL to be used to clone this remote repository.

View file

@ -7,10 +7,10 @@ use PHPCensor\Builder;
/**
* Remote Subversion Build Model
*
*
* @author Nadir Dzhilkibaev <imam.sharif@gmail.com>
*/
class SubversionBuild extends Build
class SvnBuild extends Build
{
protected $svnCommand = 'svn export -q --non-interactive ';
@ -21,7 +21,7 @@ class SubversionBuild extends Build
{
$url = rtrim($this->getProject()->getReference(), '/') . '/';
$branch = ltrim($this->getBranch(), '/');
// For empty default branch or default branch name like "/trunk" or "trunk" (-> "trunk")
if (empty($branch) || $branch == 'trunk') {
$url .= 'trunk';