forked from extern/egroupware
teach ./svn-helper.php up to cope with apps being git repos
This commit is contained in:
parent
b6ce831776
commit
601e4f39e4
@ -38,9 +38,16 @@ switch ($args[0])
|
|||||||
case 'up':
|
case 'up':
|
||||||
if (count($args) == 1) // run an svn up over all modules
|
if (count($args) == 1) // run an svn up over all modules
|
||||||
{
|
{
|
||||||
$cmd = 'svn up '.implode(' ', get_app_dirs());
|
foreach(array(
|
||||||
echo $cmd."\n";
|
'svn' => 'svn_up',
|
||||||
system($cmd);
|
'git' => 'git_pull',
|
||||||
|
) as $type => $cmd)
|
||||||
|
{
|
||||||
|
if (($modules = get_app_dirs($type)))
|
||||||
|
{
|
||||||
|
$cmd($modules);
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// fall through
|
// fall through
|
||||||
@ -56,19 +63,37 @@ switch ($args[0])
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function git_pull(array $modules)
|
||||||
|
{
|
||||||
|
foreach($modules as $module)
|
||||||
|
{
|
||||||
|
$cmd = "(cd $module; git pull)";
|
||||||
|
echo $cmd."\n";
|
||||||
|
system($cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function svn_up(array $modules)
|
||||||
|
{
|
||||||
|
$cmd = 'svn up '.implode(' ', $modules);
|
||||||
|
echo $cmd."\n";
|
||||||
|
system($cmd);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get all EGroupware application directories including "."
|
* Get all EGroupware application directories including "."
|
||||||
*
|
*
|
||||||
* @return array module => relativ path pairs, "egroupware" => ".", "addressbook" => "addressbook", ...
|
* @return array module => relativ path pairs, "egroupware" => ".", "addressbook" => "addressbook", ...
|
||||||
*/
|
*/
|
||||||
function get_app_dirs()
|
function get_app_dirs($type='svn')
|
||||||
{
|
{
|
||||||
$app_dirs = array();
|
$app_dirs = array();
|
||||||
foreach(scandir(__DIR__) as $dir)
|
foreach(scandir(__DIR__) as $dir)
|
||||||
{
|
{
|
||||||
$path = __DIR__ . '/'. $dir;
|
$path = __DIR__ . '/'. $dir;
|
||||||
if (!is_dir($path) || in_array($dir, array('debian','home','doc','..','.svn')) ||
|
if (!is_dir($path) || in_array($dir, array('debian','home','doc','..','.svn')) ||
|
||||||
!is_dir($path.'/setup') && $dir != 'setup'|| $dir =='felamimail' || $dir =='messenger') continue;
|
!is_dir($path.'/setup') && $dir != 'setup') continue;
|
||||||
|
if (file_exists($path.'/.git') != ($type == 'git')) continue;
|
||||||
$app_dirs[$dir == '.' ? 'egroupware' : $dir] = $dir;
|
$app_dirs[$dir == '.' ? 'egroupware' : $dir] = $dir;
|
||||||
}
|
}
|
||||||
//error_log(__METHOD__."() returning ".print_r($app_dirs, true));
|
//error_log(__METHOD__."() returning ".print_r($app_dirs, true));
|
||||||
|
Loading…
Reference in New Issue
Block a user