Merge pull request #85 from sanpii/remote
Allow arbitrary repository URL
This commit is contained in:
commit
b767da324a
|
@ -28,6 +28,9 @@ class BuildFactory
|
||||||
{
|
{
|
||||||
switch($base->getProject()->getType())
|
switch($base->getProject()->getType())
|
||||||
{
|
{
|
||||||
|
case 'remote':
|
||||||
|
$type = 'RemoteGitBuild';
|
||||||
|
break;
|
||||||
case 'local':
|
case 'local':
|
||||||
$type = 'LocalBuild';
|
$type = 'LocalBuild';
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -252,12 +252,13 @@ class ProjectController extends \PHPCI\Controller
|
||||||
'choose' => 'Select repository type...',
|
'choose' => 'Select repository type...',
|
||||||
'github' => 'Github',
|
'github' => 'Github',
|
||||||
'bitbucket' => 'Bitbucket',
|
'bitbucket' => 'Bitbucket',
|
||||||
|
'remote' => 'Remote URL',
|
||||||
'local' => 'Local Path'
|
'local' => 'Local Path'
|
||||||
);
|
);
|
||||||
|
|
||||||
$field = new Form\Element\Select('type');
|
$field = new Form\Element\Select('type');
|
||||||
$field->setRequired(true);
|
$field->setRequired(true);
|
||||||
$field->setPattern('^(github|bitbucket|local)');
|
$field->setPattern('^(github|bitbucket|remote|local)');
|
||||||
$field->setOptions($options);
|
$field->setOptions($options);
|
||||||
$field->setLabel('Where is your project hosted?');
|
$field->setLabel('Where is your project hosted?');
|
||||||
$field->setClass('span4');
|
$field->setClass('span4');
|
||||||
|
@ -275,6 +276,11 @@ class ProjectController extends \PHPCI\Controller
|
||||||
$type = $values['type'];
|
$type = $values['type'];
|
||||||
|
|
||||||
switch($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':
|
case 'local':
|
||||||
if (!is_dir($val)) {
|
if (!is_dir($val)) {
|
||||||
throw new \Exception('The path you specified does not exist.');
|
throw new \Exception('The path you specified does not exist.');
|
||||||
|
|
|
@ -19,12 +19,15 @@ use Symfony\Component\Yaml\Parser as YamlParser;
|
||||||
* @package PHPCI
|
* @package PHPCI
|
||||||
* @subpackage Core
|
* @subpackage Core
|
||||||
*/
|
*/
|
||||||
abstract class RemoteGitBuild extends Build
|
class RemoteGitBuild extends Build
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Get the URL to be used to clone this remote repository.
|
* 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.
|
* Create a working copy by cloning, copying, or similar.
|
||||||
|
|
Loading…
Reference in a new issue