Merge pull request #85 from sanpii/remote
Allow arbitrary repository URL
This commit is contained in:
commit
b767da324a
3 changed files with 15 additions and 3 deletions
|
|
@ -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.');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue