diff --git a/PHPCI/BuildFactory.php b/PHPCI/BuildFactory.php index ad4dd0a5..c4479b05 100644 --- a/PHPCI/BuildFactory.php +++ b/PHPCI/BuildFactory.php @@ -28,6 +28,9 @@ class BuildFactory { switch($base->getProject()->getType()) { + case 'remote': + $type = 'RemoteGitBuild'; + break; case 'local': $type = 'LocalBuild'; break; diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index 27ec611e..243342c6 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -252,12 +252,13 @@ class ProjectController extends \PHPCI\Controller 'choose' => 'Select repository type...', 'github' => 'Github', 'bitbucket' => 'Bitbucket', + 'remote' => 'Remote URL', 'local' => 'Local Path' ); $field = new Form\Element\Select('type'); $field->setRequired(true); - $field->setPattern('^(github|bitbucket|local)'); + $field->setPattern('^(github|bitbucket|remote|local)'); $field->setOptions($options); $field->setLabel('Where is your project hosted?'); $field->setClass('span4'); @@ -275,6 +276,11 @@ class ProjectController extends \PHPCI\Controller $type = $values['type']; switch($type) { + case 'remote': + if (!preg_match('/^(git|https?):\/\//', $val)) { + throw new \Exception('Repository URL must be start with git://, http:// or https://.'); + } + break; case 'local': if (!is_dir($val)) { throw new \Exception('The path you specified does not exist.'); diff --git a/PHPCI/Model/Build/RemoteGitBuild.php b/PHPCI/Model/Build/RemoteGitBuild.php index 0670f6db..d1fe1c74 100644 --- a/PHPCI/Model/Build/RemoteGitBuild.php +++ b/PHPCI/Model/Build/RemoteGitBuild.php @@ -19,12 +19,15 @@ use Symfony\Component\Yaml\Parser as YamlParser; * @package PHPCI * @subpackage Core */ -abstract class RemoteGitBuild extends Build +class RemoteGitBuild extends Build { /** * Get the URL to be used to clone this remote repository. */ - abstract protected function getCloneUrl(); + protected function getCloneUrl() + { + return $this->getProject()->getReference(); + } /** * Create a working copy by cloning, copying, or similar.