updated lib git reference, included all subrepos, fixed git & startpage git infos

This commit is contained in:
Ulf Gebhardt 2017-07-24 11:27:25 +02:00
parent 8568531da0
commit 2e181ce628
6 changed files with 63 additions and 27 deletions

@ -1 +1 @@
Subproject commit f9b9a5ad101b15e95094560b8c48064a4147b7b7
Subproject commit c0b6ba477ddef31f20b1363256e0a87c1c93b06e

View File

@ -22,7 +22,7 @@ class saimod_sys_git extends \SYSTEM\SAI\SaiModule {
*/
public static function sai_mod__SYSTEM_SAI_saimod_sys_git(){
$vars = \SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_GIT);
$vars = array_merge($vars,self::getGitInfo());
$vars['panels'] = self::getGitInfo();
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_git/tpl/saimod_sys_git.tpl'))->SERVERPATH(), $vars);}
/**
@ -32,24 +32,34 @@ class saimod_sys_git extends \SYSTEM\SAI\SaiModule {
*/
public static function getGitInfo(){
\LIB\lib_git::php();
$result = array('git_project' => '', 'git_system' => '');
try{
$repo = \GIT\Git::open(\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH));
$result['git_project'] = '<a href="http://www.mojotrollz.eu/git/hosting/commit/'.$repo->run('rev-parse HEAD').'" target="_blank">'.$repo->run('rev-parse --short HEAD').'</a><br/>';
$result['git_project'] .= $repo->run('log -1 --pretty=%B');
} catch (\Exception $ex) {
$result['git_project'] = $ex->getMessage();
$gits = array(array('title' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_SAI_CONFIG_PROJECT), 'path' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH)),
);//array('title' => 'Current SYSTEM Version', 'path' => \SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH).\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL)));
$result = '';
$i = 0;
while($i < count($gits)){
$git = $gits[$i];
try{
$repo = \GIT\Git::open($git['path']);
$git['git_project'] = $repo->run('ls-remote --get-url').'<br><br>';
$git['git_project'] .= nl2br(htmlentities($repo->run('log --date=relative --graph -3')));
$subs = explode("\n",$repo->run('config --file .gitmodules --get-regexp path'));
foreach($subs as $sub){
if($sub == ''){
continue;}
$gits[] = array('title' => $git['title'].'/'.explode('.',$sub)[1],
'path' => $git['path'].preg_replace('/\s+/', '', explode('path ',$sub)[1]).'/');
//echo $git['title'].'/'.explode('.',$sub)[1].' - '.$git['path'].preg_replace('/\s+/', '', explode('path ',$sub)[1]).'/<br>';
}
} catch (\Exception $ex) {
$git['git_project'] = 'Error: '.$git['path'].' '.$ex->getMessage();
}
$i++;
$result .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_git/tpl/saimod_sys_git_panel.tpl'))->SERVERPATH(), $git);
}
try{
$repo = \GIT\Git::open(\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH).\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_SYSTEMPATHREL));
$result['git_system'] .= '<li>';
$result['git_system'] = '<a href="http://www.mojotrollz.eu/git/system/commit/'.$repo->run('rev-parse HEAD').'" target="_blank">'.$repo->run('rev-parse --short HEAD').'</a><br/>';
$result['git_system'] .= $repo->run('log -1 --pretty=%B');
} catch (\Exception $ex) {
$result['git_system'] = $ex->getMessage();
}
return $result;
}

View File

@ -1,5 +1,13 @@
<h4>${sai_git_title}</h4>
<hr>
<b>Current Project Version:</b> ${git_project}
<br>
<b>Current SYSTEM Version:</b> ${git_system}
<div class="row-fluid">
<div class="col-md-12">
<h4><span class="glyphicon glyphicon-saved" aria-hidden="true"></span>&nbsp;&nbsp;${sai_git_title}</h4>
</div>
</div>
<div class="row">
<div class="col-md-12">
<hr>
</div>
</div>
<div class="row-fluid">
${panels}
</div>

View File

@ -0,0 +1,10 @@
<div class="col-md-6">
<div id="project" class="panel panel-default sai_gridbox">
<div class="panel-heading"><b>${title}</b></div>
<div class="panel-body">
<div class="inner-page">
${git_project}
</div>
</div>
</div>
</div>

View File

@ -43,10 +43,19 @@ class saistart_sys_sai extends \SYSTEM\SAI\SaiModule {
$stat['perc'] = round($stat['state_closed'] / ($stat['state_open']+$stat['state_closed']),2)*100;
$vars['userstats'] .= \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saimod_sys_todo/tpl/todo_stats_users_entry.tpl'))->SERVERPATH(), $stat);
}
\LIB\lib_git::php();
try{
$repo = \GIT\Git::open(\SYSTEM\CONFIG\config::get(\SYSTEM\CONFIG\config_ids::SYS_CONFIG_PATH_BASEPATH));
$vars['git'] = $repo->run('ls-remote --get-url').'<br><br>';
$vars['git'] .= nl2br(htmlentities($repo->run('log --date=relative -1')));
} catch (\Exception $ex) {
$vars['git'] = 'Error: '.$ex->getMessage();
}
$vars = array_merge( $vars,
\SYSTEM\SAI\saimod_sys_todo::statistics(),
\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START),
\SYSTEM\SAI\saimod_sys_git::getGitInfo());
\SYSTEM\PAGE\text::tag(\SYSTEM\SQL\system_text::TAG_SAI_START));
return \SYSTEM\PAGE\replace::replaceFile((new \SYSTEM\PSAI('modules/saistart_sys_sai/tpl/content_loggedin.tpl'))->SERVERPATH(), $vars);
}

View File

@ -85,8 +85,7 @@
<div class="panel-heading"><a href="#!git">${basic_git}</a></div>
<div class="panel-body">
<div class="inner-page">
<b>Current Project Version:</b> ${git_project}<br/>
<b>Current SYSTEM Version:</b> ${git_system}
${git}
</div>
</div>
</div>