Compare commits

...

4 commits

16 changed files with 93 additions and 4 deletions

View file

@ -138,6 +138,9 @@ and Services</a> under dit GitHub-repository.',
'webhooks_help_gitlab' => 'For at køre dette build automatisk når nye commits bliver pushed kan du tilføje nedenstående URL
som en "WebHook URL" i Web Hooks-sektionen i dit GitLab-repository.',
'webhooks_help_gogs' => 'For at køre dette build automatisk når nye commits bliver pushed kan du tilføje nedenstående URL
som en "WebHook URL" i Web Hooks-sektionen i dit Gogs-repository.',
'webhooks_help_bitbucket' => 'For at køre dette build automatisk når nye commits bliver pushed skal du tilføje nedenstående
URL som "POST" service i
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -140,6 +140,8 @@ generiert. Um es zu verwenden, fügen Sie einfach den folgenden Public Key im Ab
'webhooks_help_gitlab' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL in der Web Hooks Sektion Ihres GitLab Repositories hinzu.',
'webhooks_help_gogs' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL in der Web Hooks Sektion Ihres Gogs Repositories hinzu.',
'webhooks_help_bitbucket' => 'Um für dieses Projekt automatisch einen Build zu starten, wenn neue Commits gepushed werden, fügen Sie die untenstehende URL als "POST" Service in der <a href="https://bitbucket.org/%s/admin/services">Services</a>-Sektion Ihres Bitbucket Repositories hinzu.',
// View Build

View file

@ -139,6 +139,9 @@ and Services</a> του GitHub αποθετηρίου σας.',
'webhooks_help_gitlab' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε την διεύθυνση URL παρακάτω
σαν "WebHook URL" στο τμήμα Web Hooks του GitLab αποθετηρίου σας.',
'webhooks_help_gogs' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε την διεύθυνση URL παρακάτω
σαν "WebHook URL" στο τμήμα Web Hooks του Gogs αποθετηρίου σας.',
'webhooks_help_bitbucket' => 'Για την αυτόματη κατασκευή αυτού του έργου όταν υπάρχουν νέες συνεισφορές, προσθέστε τη διεύθυνση URL παρακάτω
ως μια υπηρεσία "POST" στο τμήμα <a href="https://bitbucket.org/%s/admin/services">
Services</a> του Bitbucket αποθετηρίου σας.',

View file

@ -165,6 +165,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'To automatically build this project when new commits are pushed, add the URL below
as a "WebHook URL" in the Web Hooks section of your GitLab repository.',
'webhooks_help_gogs' => 'To automatically build this project when new commits are pushed, add the URL below
as a "WebHook URL" in the Web Hooks section of your Gogs repository.',
'webhooks_help_bitbucket' => 'To automatically build this project when new commits are pushed, add the URL below
as a "POST" service in the
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -138,6 +138,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'Para compilar automáticamente este proyecto, cada vez que se realiza un commit, agreagar la siguiente URL
como una "WebHook URL" en la sección "web hooks" de tu repositorio en GitLab.',
'webhooks_help_gogs' => 'Para compilar automáticamente este proyecto, cada vez que se realiza un commit, agreagar la siguiente URL
como una "WebHook URL" en la sección "web hooks" de tu repositorio en Gogs.',
'webhooks_help_bitbucket' => 'Para compilar automáticamente este proyecto, cada vez que se realiza un commit, agreagar la siguiente URL
como un servicio "POST" en la sección
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -167,6 +167,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante
en tant que "WebHook URL" dans la section "Web Hooks" de votre dépôt GitLab.',
'webhooks_help_gogs' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante
en tant que "WebHook URL" dans la section "Web Hooks" de votre dépôt Gogs.',
'webhooks_help_bitbucket' => 'Pour générer un build quand de nouveaux commits sont poussés, ajouter l\'url suivante
en tant que service "POST" dans la section
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -139,6 +139,10 @@ PHP Censor',
aggiungi l\'URL seguente come "Webhook URL" nella sezione "WebHook URL" del tuo
repository GitLab.',
'webhooks_help_gogs' => 'Per effettuare la build automatica di questo progetto quando vengono inseriti nuovi commit,
aggiungi l\'URL seguente come "Webhook URL" nella sezione "WebHook URL" del tuo
repository Gogs.',
'webhooks_help_bitbucket' => 'Per effettuare la build automatica di questo progetto quando vengono inseriti nuovi
commit, aggiungi l\'URL seguente come serizio "POST" nella sezione
<a href="https://bitbucket.org/%s/admin/services">Services</a> del tuo repository su

View file

@ -139,6 +139,9 @@ and Services</a> sectie van je GitHub repository toegevoegd worden.',
'webhooks_help_gitlab' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL
als nieuwe "Webhook URL" in de Web Hooks sectie van je GitLab repository toegevoegd worden.',
'webhooks_help_gogs' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL
als nieuwe "Webhook URL" in de Web Hooks sectie van je Gogs repository toegevoegd worden.',
'webhooks_help_bitbucket' => 'Voor automatische builds wanneer nieuwe commits worden gepusht, dient onderstaande URL
als "POST" service in de in de
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -140,6 +140,9 @@ od wybranego kodu źródłowego platformy hostingowej.',
'webhooks_help_gitlab' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów dodaj poniższy adres URL
jako "WebHook URL" w sekcji Web Hook Twojego repozytoria GitLab.',
'webhooks_help_gogs' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów dodaj poniższy adres URL
jako "WebHook URL" w sekcji Web Hook Twojego repozytoria Gogs.',
'webhooks_help_bitbucket' => 'Aby automatycznie uruchomić nową budowę po wysłaniu commitów, dodaj poniższy adres URL
jako usługę "POST" w sekcji
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -137,6 +137,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'To automatically build this project when new commits are pushed, add the URL below
as a "WebHook URL" in the Web Hooks section of your GitLab repository.',
'webhooks_help_gogs' => 'To automatically build this project when new commits are pushed, add the URL below
as a "WebHook URL" in the Web Hooks section of your Gogs repository.',
'webhooks_help_bitbucket' => 'To automatically build this project when new commits are pushed, add the URL below
as a "POST" service in the
<a href="https://bitbucket.org/%s/admin/services">

View file

@ -160,6 +160,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве "WebHook URL"
в разделе "Web Hooks" вашего GitLab репозитория.',
'webhooks_help_gogs' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже в качестве "WebHook URL"
в разделе "Web Hooks" вашего Gogs репозитория.',
'webhooks_help_bitbucket' => 'Чтобы Автоматически собирать этот проект при публикации новых коммитов, добавьте URL ниже как "POST" сервис в разделе <a href="https://bitbucket.org/%s/admin/services">
Services</a> вашего Bitbucket репозитория.',

View file

@ -139,6 +139,9 @@ PHP Censor',
'webhooks_help_gitlab' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL
у якості нового "WebHook URL" у розділі "Web Hooks" вашого GitLab репозиторію.',
'webhooks_help_gogs' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL
у якості нового "WebHook URL" у розділі "Web Hooks" вашого Gogs репозиторію.',
'webhooks_help_bitbucket' => 'Для автоматичної збірки цього проекту, при надходженні нових комітів, додайте наступний URL
у якості нового "POST" сервісу у розділі
<a href="https://bitbucket.org/%s/admin/services">Services</a>

View file

@ -136,6 +136,8 @@ PHP Censor',
'webhooks_help_gitlab' => '要想当您的仓库由新的提交推送时自动构建请在您的GitLab仓库的 "WebHook URL" 添加该URL。',
'webhooks_help_gogs' => '要想当您的仓库由新的提交推送时自动构建请在您的Gogs仓库的 "WebHook URL" 添加该URL。',
'webhooks_help_bitbucket' => '要想当您的仓库由新的提交推送时自动构建请在您的GitLab仓库的
<a href="https://bitbucket.org/%s/admin/services">
Services</a> 将该URL添加成 “POST服务”。',

View file

@ -7,12 +7,20 @@ namespace PHPCensor\Model\Build;
*/
class GogsBuild extends GitBuild
{
/**
* Get a cleaned reference to generate link
*/
protected function getCleanedReferenceForLink()
{
return preg_replace('/\.git$/i', '', $this->getProject()->getReference());
}
/**
* Get link to commit from Gogs repository
*/
public function getCommitLink()
{
return $this->getProject()->getReference() . '/commit/' . $this->getCommitId();
return $this->getCleanedReferenceForLink() . '/commit/' . $this->getCommitId();
}
/**
@ -20,8 +28,9 @@ class GogsBuild extends GitBuild
*/
public function getBranchLink()
{
return $this->getProject()->getReference() . '/src/' . $this->getBranch();
return $this->getCleanedReferenceForLink() . '/src/' . $this->getBranch();
}
/**
* Get link to specific file (and line) in a the repo's branch
*/
@ -29,7 +38,7 @@ class GogsBuild extends GitBuild
{
return sprintf(
'%s/src/%s/{FILE}#L{LINE}',
$this->getProject()->getReference(),
$this->getCleanedReferenceForLink(),
$this->getCommitId()
);
}

View file

@ -164,7 +164,8 @@ use PHPCensor\Model\Project;
Project::TYPE_GITHUB,
Project::TYPE_GITLAB,
Project::TYPE_BITBUCKET,
Project::TYPE_BITBUCKET_HG
Project::TYPE_BITBUCKET_HG,
Project::TYPE_GOGS,
])): ?>
<div class="box">
<div class="box-header">
@ -193,6 +194,10 @@ use PHPCensor\Model\Project;
$url = APP_URL . 'webhook/bitbucket/' . $project->getId();
echo Lang::get('webhooks_help_bitbucket', $project->getReference());
break;
case Project::TYPE_GOGS:
$url = APP_URL . 'webhook/gogs/' . $project->getId();
echo Lang::get('webhooks_help_gogs', $project->getReference());
break;
} ?>
<br><br><strong style="word-wrap: break-word;"><?= $url; ?></strong>
</div>

View file

@ -4,6 +4,8 @@ namespace Tests\PHPCensor\Model;
use PHPCensor\Exception\InvalidArgumentException;
use PHPCensor\Model\Build;
use PHPCensor\Model\Project;
use PHPCensor\Model\Build\GogsBuild;
/**
* Unit tests for the Build model class.
@ -138,4 +140,39 @@ class BuildTest extends \PHPUnit\Framework\TestCase
self::assertEquals('Item One', $build->getExtra('item1'));
self::assertEquals('Item Three', $build->getExtra('item3'));
}
public function testGogsBuildLinks()
{
$project = new Project();
$project->setType(Project::TYPE_GOGS);
$project->setReference('https://gogs.repository/the-vendor/the-project.git');
$stub = $this->getMockBuilder(GogsBuild::class)
->setMethods(['getProject', 'getCommitId', 'getBranch'])
->getMock();
$stub->method('getProject')
->will($this->returnValue($project));
$stub->method('getCommitId')
->will($this->returnValue('abcdef'));
$stub->method('getBranch')
->will($this->returnValue('master'));
$this->assertEquals(
'https://gogs.repository/the-vendor/the-project/commit/abcdef',
$stub->getCommitLink()
);
$this->assertEquals(
'https://gogs.repository/the-vendor/the-project/src/master',
$stub->getBranchLink()
);
$this->assertEquals(
'https://gogs.repository/the-vendor/the-project/src/abcdef/{FILE}#L{LINE}',
$stub->getFileLinkTemplate()
);
}
}