Refactoring builds out into separate model types (Github, Bitbucket, Local) and builder to use build->createWorkingCopy() to make build directory. Fixes #29

This commit is contained in:
Dan Cryer 2013-05-15 23:47:37 +01:00
commit be37a5e821
9 changed files with 304 additions and 150 deletions

View file

@ -0,0 +1,38 @@
<?php
/**
* Build model for table: build
*/
namespace PHPCI\Model\Build;
use PHPCI\Model\Build;
use PHPCI\Model\Build\RemoteGitBuild;
/**
* Build Model
* @uses PHPCI\Model\Build
*/
class BitbucketBuild extends RemoteGitBuild
{
public function getCommitLink()
{
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '/commits/' . $this->getCommitId();
}
public function getBranchLink()
{
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '/src/?at=' . $this->getBranch();
}
protected function getCloneUrl()
{
$key = trim($this->getProject()->getGitKey());
if(!empty($key)) {
return 'git@bitbucket.org:' . $this->getProject()->getReference() . '.git';
}
else {
return 'https://bitbucket.org/' . $this->getProject()->getReference() . '.git';
}
}
}