Allow arbitrary repository URL
This commit is contained in:
parent
a8ad93bb66
commit
7f09e4df07
|
@ -28,6 +28,9 @@ class BuildFactory
|
|||
{
|
||||
switch($base->getProject()->getType())
|
||||
{
|
||||
case 'remote':
|
||||
$type = 'RemoteGitBuild';
|
||||
break;
|
||||
case 'local':
|
||||
$type = 'LocalBuild';
|
||||
break;
|
||||
|
|
|
@ -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.');
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in a new issue