Added a simpler way to configure the repositories.

dev
Loic d'Anterroches 2008-11-24 20:27:03 +01:00
parent 9d1a4cad01
commit 39d015a586
4 changed files with 32 additions and 58 deletions

View File

@ -43,11 +43,7 @@ class IDF_Scm_Git
*/ */
public static function getRemoteAccessUrl($project) public static function getRemoteAccessUrl($project)
{ {
$url = Pluf::f('git_remote_url'); return sprintf(Pluf::f('git_remote_url'), $project->shortname);
if (Pluf::f('git_repositories_unique', true)) {
return $url;
}
return $url.'/'.$project->shortname.'.git';
} }
/** /**
@ -58,10 +54,7 @@ class IDF_Scm_Git
*/ */
public static function factory($project) public static function factory($project)
{ {
$rep = Pluf::f('git_repositories'); $rep = sprintf(Pluf::f('git_repositories'), $project->shortname);
if (false == Pluf::f('git_repositories_unique', false)) {
$rep = $rep.'/'.$project->shortname.'.git';
}
return new IDF_Scm_Git($rep); return new IDF_Scm_Git($rep);
} }

View File

@ -42,11 +42,7 @@ class IDF_Scm_Mercurial
*/ */
public static function getRemoteAccessUrl($project) public static function getRemoteAccessUrl($project)
{ {
$url = Pluf::f('mercurial_remote_url'); return sprintf(Pluf::f('mercurial_remote_url'), $project->shortname);
if (Pluf::f('mercurial_repositories_unique', true)) {
return $url;
}
return $url.'/'.$project->shortname;
} }
/** /**
@ -57,10 +53,7 @@ class IDF_Scm_Mercurial
*/ */
public static function factory($project) public static function factory($project)
{ {
$rep = Pluf::f('mercurial_repositories'); $rep = sprintf(Pluf::f('mercurial_repositories'), $project->shortname);
if (false == Pluf::f('mercurial_repositories_unique', false)) {
$rep = $rep.'/'.$project->shortname;
}
return new IDF_Scm_Mercurial($rep); return new IDF_Scm_Mercurial($rep);
} }

View File

@ -55,11 +55,7 @@ class IDF_Scm_Svn
// Remote repository // Remote repository
return $url; return $url;
} }
$url = Pluf::f('svn_remote_url'); return sprintf(Pluf::f('svn_remote_url'), $project->shortname);
if (Pluf::f('svn_repositories_unique', true)) {
return $url;
}
return $url.'/'.$project->shortname;
} }
/** /**
@ -79,10 +75,7 @@ class IDF_Scm_Svn
$conf->getVal('svn_username'), $conf->getVal('svn_username'),
$conf->getVal('svn_password')); $conf->getVal('svn_password'));
} else { } else {
$rep = Pluf::f('svn_repositories'); $rep = sprintf(Pluf::f('svn_repositories'), $project->shortname);
if (false == Pluf::f('svn_repositories_unique', false)) {
$rep = $rep.'/'.$project->shortname;
}
return new IDF_Scm_Svn($rep); return new IDF_Scm_Svn($rep);
} }
} }

View File

@ -26,21 +26,27 @@ $cfg = array();
// to start with, it can be practical. // to start with, it can be practical.
$cfg['debug'] = false; $cfg['debug'] = false;
// if you have a single git repository, just put the full path to it // If you have a single git repository, just put the full path to it
// without trailing slash. // without trailing slash. The path is the path to the git database,
// If within a folder you have a series of bare git repository, just // so you need to include the /.git folder.
// put the folder without a trailing slash. // For example: '/path/to/my/project/.git'
// InDefero will automatically append a slash, the project shortname //
// and .git to create the name of the repository. // If you have multiple repositories, you need to put %s where you
$cfg['git_repositories'] = '/home/git/repositories/indefero.git'; // want the shortname of the project to be replaced.
$cfg['git_repositories_unique'] = true; // For example:
$cfg['git_remote_url'] = 'git://projects.ceondo.com/indefero.git'; // - You have many projects on your local computer and want to use
// InDefero to see them. Put: '/home/yourlogin/Projects/%s/.git'
// One git repository per project. "/".$project->shortname.".git" // - You have many projects on a remote server with only "bare" git
// is automatically added to the end of the path/url. // repositories. Put: '/home/git/repositories/%s.git'
//$cfg['git_repositories'] = '/home/git/repositories'; //
//$cfg['git_repositories_unique'] = false; $cfg['git_repositories'] = '/home/git/repositories/%s.git';
//$cfg['git_remote_url'] = 'git://projects.ceondo.com'; //
// Like for the git_repositories definition, the path can contains %s
// and it will be automatically replaced. You can ignore this
// configuration variable as it is only for information use in the
// tree view.
//
$cfg['git_remote_url'] = 'git://projects.ceondo.com/%s.git';
// Same as for git, you can have multiple repositories, one for each // Same as for git, you can have multiple repositories, one for each
// project or a single one for all the projects. // project or a single one for all the projects.
@ -49,24 +55,12 @@ $cfg['git_remote_url'] = 'git://projects.ceondo.com/indefero.git';
// remote repository from the web interface. From the web interface // remote repository from the web interface. From the web interface
// you can define a local repository, local repositories are defined // you can define a local repository, local repositories are defined
// here. This if for security reasons. // here. This if for security reasons.
$cfg['svn_repositories'] = 'file:///home/svn/repositories/indefero'; $cfg['svn_repositories'] = 'file:///home/svn/repositories/%s';
$cfg['svn_repositories_unique'] = true; $cfg['svn_remote_url'] = 'http://projects.ceondo.com/svn/%s';
$cfg['svn_remote_url'] = 'http://projects.ceondo.com/svn/indefero';
// Mercurial repositories path // Mercurial repositories path
//$cfg['mercurial_repositories'] = '/home/mercurial/repositories'; //$cfg['mercurial_repositories'] = '/home/mercurial/repositories/%s';
//$cfg['mercurial_repositories_unique'] = false; //$cfg['mercurial_remote_url'] = 'http://projects.ceondo.com/hg/%s';
//$cfg['mercurial_remote_url'] = 'http://projects.ceondo.com/hg';
// Example of one *local* subversion repository for each project:
// the path to the repository on disk will automatically created to be
// 'file:///home/svn/repositories'.'/'.$project->shortname
// the url will be generated the same way:
// 'http://projects.ceondo.com/svn'.'/'.$project->shortname
// $cfg['svn_repositories'] = 'file:///home/svn/repositories';
// $cfg['svn_repositories_unique'] = false;
// $cfg['svn_remote_url'] = 'http://projects.ceondo.com/svn';
// admins will get an email in case of errors in the system in non // admins will get an email in case of errors in the system in non
// debug mode. // debug mode.
@ -178,6 +172,7 @@ $cfg['languages'] = array('en', 'fr');
# SCM base configuration # SCM base configuration
$cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git', $cfg['allowed_scm'] = array('git' => 'IDF_Scm_Git',
'svn' => 'IDF_Scm_Svn', 'svn' => 'IDF_Scm_Svn',
'mercurial' => 'IDF_Scm_Mercurial',
); );