diff --git a/00_demo/build.htm.php b/00_demo/build.htm.php deleted file mode 100644 index 789dd6a73ec6be9aa340d44f1b85f68286476ca8..0000000000000000000000000000000000000000 --- a/00_demo/build.htm.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -require_once("../config/inc_projects_config.php"); -require_once("../classes/project.class.php"); -require_once("../classes/formgen.class.php"); - -require_once("inc_functions.php"); - -$sOut='<h1>Build</h1>'; -$sError=''; - -// --- Checks -if (!array_key_exists("prj", $_GET)){ - $sError.='<li>Es wurde kein Projekt angegeben.</li>'; -} - - -if ($sError){ - $sOut.='<i class="icon-exclamation-sign"></i> FEHLER:<ul>'.$sError.'</ul>'; - -} else { - $oPrj=new project($_GET["prj"]); - $sNext=$oPrj->getNextPhase(); - $sOut=' - <h1>Build '.$oPrj->getLabel().'</h1> - <p>' . $oPrj->getDescription() . '</p> - <hr> - <p> - Es wird ein neues Paket erstellt und auf die Phase <em class="'.$sNext.'">'.$sNext.'</em> installiert.<br> - Du kannst einen Kommentar zu diesem Deployment angeben und darin beschreiben, worin das Update - besteht (Fix, neue Funktion, ...). - </p> - '; - - // Eingabe Kommentare zum Deployment - //$oForm=new formgen(); - $sOut.=' - <hr> - ' . enterDeployinfos() . ' - <hr> - Aktionen - '; -} - -$sOut.=aHome(); -// -- Ausgabe -$sPhpOut=$sOut; -?> - diff --git a/index.html b/index.html deleted file mode 100644 index 79662602a23ca0c8c8b2e59d628fac5639d2ef67..0000000000000000000000000000000000000000 --- a/index.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> - <head> - <meta http-equiv="refresh" content="1;url=00_demo/index.htm" /> - </head> - <body> - <h1>Weiterleitung ...</h1> - <p> - <a href="00_demo/index.htm">Startseite</a> - </p> - </body> -</html> diff --git a/.htaccess b/public_html/deployment/.htaccess similarity index 100% rename from .htaccess rename to public_html/deployment/.htaccess diff --git a/classes/classinfos.class.php b/public_html/deployment/classes/classinfos.class.php similarity index 100% rename from classes/classinfos.class.php rename to public_html/deployment/classes/classinfos.class.php diff --git a/classes/formgen.class.php b/public_html/deployment/classes/formgen.class.php similarity index 100% rename from classes/formgen.class.php rename to public_html/deployment/classes/formgen.class.php diff --git a/classes/lang.class.php b/public_html/deployment/classes/lang.class.php similarity index 100% rename from classes/lang.class.php rename to public_html/deployment/classes/lang.class.php diff --git a/classes/project.class.php b/public_html/deployment/classes/project.class.php similarity index 63% rename from classes/project.class.php rename to public_html/deployment/classes/project.class.php index d34d3ea45364af4220772df99a9967cb043a1ae8..54d87d1e909d07f60d04405e3ebf07903e45d2e5 100644 --- a/classes/project.class.php +++ b/public_html/deployment/classes/project.class.php @@ -8,12 +8,19 @@ class project { // ---------------------------------------------------------------------- // CONFIG // ---------------------------------------------------------------------- - protected $_aConfig = array(); - protected $_aData = array(); - protected $_sPackageDir = false; - protected $_aPhases=array(); - protected $_sCfgfile="../config/inc_projects_config.php"; - + private $_aConfig = array(); + private $_aData = array(); + private $_sWorkDir = false; + private $_sPackageDir = false; + private $_aPhases=array(); + private $_sCfgfile="../config/inc_projects_config.php"; + + private $_aPlaces=array( + "onhold"=>"Queue", + "ready4deployment"=>"Repo", + "deployed"=>"Installiert", + ); + // ---------------------------------------------------------------------- // constructor // ---------------------------------------------------------------------- @@ -39,7 +46,8 @@ class project { */ private function _readConfig() { require($this->_sCfgfile); - $this->_sPackageDir = $aConfig['packageDir']; + $this->_sWorkDir = $aConfig['workDir']; + $this->_sPackageDir = $this->_sWorkDir.'/packages'; $this->_aPhases=$aConfig["phases"]; return true; } @@ -61,10 +69,99 @@ class project { return true; } + private function _execAndSend($sCommand){ + $sReturn=''; + $bUseHtml=$_SERVER?true:false; + + ob_implicit_flush(true);ob_end_flush(); + $descriptorspec = array( + 0 => array("pipe", "r"), // stdin is a pipe that the child will read from + 1 => array("pipe", "w"), // stdout is a pipe that the child will write to + 2 => array("pipe", "w") // stderr is a pipe that the child will write to + ); + flush(); + $process = proc_open($sCommand, $descriptorspec, $pipes, realpath('./'), array()); + + $sReturn.="[".date("H:i:s d.m.Y")."] $sCommand"; + $sReturn.=$bUseHtml?"<br><pre>":"\n"; + + if (is_resource($process)) { + $oStatus = proc_get_status($process); + while ($s = fgets($pipes[1])) { + $sReturn.=$s; + flush(); + } + } + $sReturn.=$bUseHtml?"</pre>":"\n"; + $sReturn.="[".date("H:i:s d.m.Y")."] finished; rc=".$oStatus['exitcode']; + $sReturn.=$bUseHtml?"<hr>":"\n---------\n"; + return $sReturn; + } + // ---------------------------------------------------------------------- // GETTER // ---------------------------------------------------------------------- - + + private function _getTempDir(){ + $s=$this->_sWorkDir."/build/".$this->_aConfig["fileprefix"]."_".date("Ymd-His"); + // TODO: auskommentieren + $s=$this->_sWorkDir."/build/".$this->_aConfig["fileprefix"]."_temp"; + return $s; + } + /** + * get base of filename for infofile and package (without extension) + * @param string $sPhase one of preview|stage|live ... + * @param string $sPlace one of onhold|ready4deployment|deployed + * @return string + */ + private function _getFileBase($sPhase, $sPlace){ + if (!array_key_exists($sPhase, $this->_aPhases)){ + die("ERROR: _getFileBase - this phase does not exist: $sPhase."); + } + if (!array_key_exists($sPlace, $this->_aPlaces)){ + die("ERROR: _getFileBase - this place does not exist: $sPhase."); + } + + + // local file for onhold|ready4deployment + $sBase=$this->_sPackageDir."/".$sPhase."/".$this->_aConfig["fileprefix"]; + + if ($sPlace=="onhold") $sBase.="_onhold"; + + // url for deployed + if ($sPlace=="deployed"){ + if ($this->isActivePhase($sPhase) && array_key_exists("url", $this->_aConfig["phases"][$sPhase])){ + $sBase=$this->_aConfig["phases"][$sPhase]["url"].$this->_aConfig["fileprefix"]; + } else { + $sBase=''; + } + } + + return $sBase; + } + + /** + * get filename for info file + * @param string $sPhase one of preview|stage|live ... + * @param string $sPlace one of onhold|ready4deployment|deployed + * @return string + */ + private function _getInfofile($sPhase, $sPlace){ + $sBase=$this->_getFileBase($sPhase, $sPlace); + return $sBase?$sBase.".json":false; + } + + /** + * get filename for package file + * @param string $sPhase one of preview|stage|live ... + * @param string $sPlace one of onhold|ready4deployment|deployed + * @return string + */ + private function _getPackagefile($sPhase, $sPlace){ + $sBase=$this->_getFileBase($sPhase, $sPlace); + return $sBase?$sBase.".tgz":false; + } + /** * get conmplete config of the project * @return array @@ -120,8 +217,7 @@ class project { // a blocked package is waiting for deployment timeslot? $sKey="onhold"; - $sBaseFilename=$this->_sPackageDir."/".$sPhase."/".$this->_aConfig["fileprefix"]; - $sJsonfile=$sBaseFilename."_onhold.json"; + $sJsonfile=$this->_getInfofile($sPhase, $sKey); $aTmp[$sKey]=array(); if (file_exists($sJsonfile)){ $aJson=json_decode(file_get_contents($sJsonfile), true); @@ -138,11 +234,10 @@ class project { // package for puppet $sKey="ready4deployment"; - $sBaseFilename=$this->_sPackageDir."/".$sPhase."/".$this->_aConfig["fileprefix"]; - $sJsonfile=$sBaseFilename.".json"; + $sJsonfile=$this->_getInfofile($sPhase, $sKey); $aTmp[$sKey]=array(); if (file_exists($sJsonfile)){ - $sPkgfile=$sBaseFilename.".tgz"; + $sPkgfile=$this->_getPackagefile($sPhase, $sKey); if (file_exists($sPkgfile)){ $aJson=json_decode(file_get_contents($sJsonfile), true); if (array_key_exists("timestamp", $aJson)){ @@ -162,6 +257,7 @@ class project { // published data $sKey="deployed"; + $sJsonfile=$this->_getInfofile($sPhase, $sKey); $aTmp[$sKey]=array(); if ($this->isActivePhase($sPhase)){ $sJsonUrl=$this->_aConfig["phases"][$sPhase]["url"].$this->_aConfig["fileprefix"].".json"; @@ -305,6 +401,42 @@ class project { // ---------------------------------------------------------------------- // ACTIONS // ---------------------------------------------------------------------- + + public function build(){ + $sReturn=false; + switch ($this->_aConfig["build"]["type"]) { + case "git": + + $sTempDir=$this->_getTempDir(); + $sFirstLevel=$this->getNextPhase(); + + // $this->_execAndSend($sCommand); + $sReturn.="TODO:<br>"; + @mkdir($sTempDir); + + $this->_execAndSend(""); + + $sReturn.="* GIT PULL ".$this->_aConfig["build"]["url"]."<br>"; + $sReturn.="* wenn Hook-Skript im Projekt, dann ausfuehren<br>"; + $sReturn.="* Check: gibt es ein public_html - wenn nein: abbrechen<br>"; + $sReturn.="* <br>"; + $sReturn.="* Info-JSON erstellen und in public_html ablegen<br>"; + $sReturn.="* Verzeichnis komprimieren zu [Paketarchiv]/[prj].tgz<br>"; + $sReturn.="* Infofilezu [Paketarchiv]/[prj].json<br>"; + $sReturn.="* Temdir loeschen ".$sTempDir."<br>"; + $sReturn.="* <br>"; + $sReturn.="* Move [Paketarchiv]/[prj].[tgz+json] zu [RepoDir-von-".$sFirstLevel."]<br>"; + $sReturn.="<br>"; + + + break; + + default: + die("Build Type not supported: " . $this->_aConfig["build"]["type"]); + break; + } + return $sReturn; + } } ?> \ No newline at end of file diff --git a/classes/projectlist.class.php b/public_html/deployment/classes/projectlist.class.php similarity index 100% rename from classes/projectlist.class.php rename to public_html/deployment/classes/projectlist.class.php diff --git a/config/inc_projects_config.php b/public_html/deployment/config/inc_projects_config.php similarity index 76% rename from config/inc_projects_config.php rename to public_html/deployment/config/inc_projects_config.php index 1e40ae22028b035371ed183824b9d1e30829022f..e8211095452358a05f1a9b60bbeb7f8c0899700f 100644 --- a/config/inc_projects_config.php +++ b/public_html/deployment/config/inc_projects_config.php @@ -29,6 +29,28 @@ $aConfig=array( // Projekte // ---------------------------------------------------------------------- $aProjects=array( + "ci"=>array( + "label"=>"CI Webgui", + "fileprefix"=>"ci-webgui", + "description" => 'Webgui zum Deployen von Web-Projekten', + "contact" => 'axel.hahn@iml.unibe.ch', + "build"=>array( + "type"=>"git", // one of git, svn, ... + "url"=>"gitlab.iml.unibe.ch:admins/imldeployment.git", + ), + + "phases"=>array( + "preview"=>array( + // "url"=>"http://preview.scrudu.iml.unibe.ch/", + "url"=>"http://ci.iml.unibe.ch/deployment/", + ), + "stage"=>array( + ), + "live"=>array( + // "url"=>"http://www.scrudu.iml.unibe.ch/" + ), + ), + ), "scrudu"=>array( "label"=>"SCRUDU", "fileprefix"=>"scrudu", @@ -42,10 +64,9 @@ $aProjects=array( "phases"=>array( "preview"=>array( // "url"=>"http://preview.scrudu.iml.unibe.ch/", - "url"=>"http://ci.iml.unibe.ch/deployment/", ), "stage"=>array( - "url"=>"http://stage.scrudu.iml.unibe.ch/" + // "url"=>"http://stage.scrudu.iml.unibe.ch/" ), "live"=>array( // "url"=>"http://www.scrudu.iml.unibe.ch/" @@ -97,7 +118,8 @@ $aTypeAbstraction=array( switch ($_SERVER["SERVER_NAME"]) { case "localhost": - $aConfig['workDir']="D:/imldeployment"; + case "dev.ci.iml.unibe.ch": + $aConfig['workDir']="D:\imldeployment"; $aProjects["scrudu"]["phases"]["preview"]["url"]="http://localhost/deployment/"; break; diff --git a/gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/LICENSE-MIT diff --git a/gfranko-Document-Bootstrap-cf0730d/README.markdown b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/README.markdown similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/README.markdown rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/README.markdown diff --git a/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/bootstrap.min.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/docs.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/docs.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/docs.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/docs.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.tocify.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/jquery.ui.all.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/prettify.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/prettify.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/prettify.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/prettify.css diff --git a/gfranko-Document-Bootstrap-cf0730d/css/styles.css b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/styles.css similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/css/styles.css rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/css/styles.css diff --git a/gfranko-Document-Bootstrap-cf0730d/customDownload.html b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/customDownload.html similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/customDownload.html rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/customDownload.html diff --git a/gfranko-Document-Bootstrap-cf0730d/documentation.html b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/documentation.html similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/documentation.html rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/documentation.html diff --git a/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings-white.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/glyphicons-halflings.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/jqueryUIEffects.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/themeroller.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/themeroller.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/themeroller.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/themeroller.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_diagonals-thick_8_333333_40x40.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_flat_65_ffffff_40x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_40_111111_1x400.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_glass_55_1c1c1c_1x400.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_100_f9f9f9_1x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-hard_40_aaaaaa_1x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_highlight-soft_50_aaaaaa_1x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_45_cd0a0a_1x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-bg_inset-hard_55_ffeb80_1x100.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_222222_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_4ca300_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_bbbbbb_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ededed_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffcf29_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/ui-icons_ffffff_256x240.png diff --git a/gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/img/widgetFactory.PNG diff --git a/gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/DownloadBuilder.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/base64.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/base64.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/base64.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/base64.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/bootstrap.min.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/githubrepo.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/history.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/history.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/history.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/history.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-1.8.0.min.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery-ui-1.8.23.custom.min.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/jquery.tocify.min.js diff --git a/gfranko-Document-Bootstrap-cf0730d/js/prettify.js b/public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/prettify.js similarity index 100% rename from gfranko-Document-Bootstrap-cf0730d/js/prettify.js rename to public_html/deployment/gfranko-Document-Bootstrap-cf0730d/js/prettify.js diff --git a/public_html/deployment/index.html b/public_html/deployment/index.html new file mode 100644 index 0000000000000000000000000000000000000000..6a48dcbb9f88816d3d9a0dd7a4d9307a3cef9dbc --- /dev/null +++ b/public_html/deployment/index.html @@ -0,0 +1,11 @@ +<html> + <head> + <meta http-equiv="refresh" content="1;url=webgui/index.htm" /> + </head> + <body> + <h1>Weiterleitung ...</h1> + <p> + <a href="webgui/index.htm">Startseite</a> + </p> + </body> +</html> diff --git a/scrudu.json b/public_html/deployment/scrudu.json similarity index 100% rename from scrudu.json rename to public_html/deployment/scrudu.json diff --git a/shared/default.tpl - bootstrap.html b/public_html/deployment/shared/default.tpl - bootstrap.html similarity index 100% rename from shared/default.tpl - bootstrap.html rename to public_html/deployment/shared/default.tpl - bootstrap.html diff --git a/shared/default.tpl.html b/public_html/deployment/shared/default.tpl.html similarity index 100% rename from shared/default.tpl.html rename to public_html/deployment/shared/default.tpl.html diff --git a/shared/default.tpl__botstrap.html b/public_html/deployment/shared/default.tpl__botstrap.html similarity index 100% rename from shared/default.tpl__botstrap.html rename to public_html/deployment/shared/default.tpl__botstrap.html diff --git a/shared/parse.php b/public_html/deployment/shared/parse.php similarity index 98% rename from shared/parse.php rename to public_html/deployment/shared/parse.php index e79f59d31d7882bbe0adea8c30ed8465f1ef12b9..32af1b3637107470eaf5d140959b4b605130a6f3 100644 --- a/shared/parse.php +++ b/public_html/deployment/shared/parse.php @@ -101,7 +101,7 @@ header('HTTP/1.0 403 Forbidden'); $sContent="<h2>Zugriff verweigert</h2> ".$aUser["Anrede"]. ",<br /> - Bitte entschuldigen Sie, aber die Anzeigefrist f�r Ihre Einsicht ist + Bitte entschuldigen Sie, aber die Anzeigefrist f�r Ihre Einsicht ist am <NOBR><strong>[".$aUser["validTo"]."]</strong></NOBR> abgelaufen.<br> "; $aCfg["prj"]=''; diff --git a/00_demo/build.htm b/public_html/deployment/webgui/build.htm similarity index 100% rename from 00_demo/build.htm rename to public_html/deployment/webgui/build.htm diff --git a/public_html/deployment/webgui/build.htm.php b/public_html/deployment/webgui/build.htm.php new file mode 100644 index 0000000000000000000000000000000000000000..2450dcd11c51c813d01873d6533b003246ffc4a7 --- /dev/null +++ b/public_html/deployment/webgui/build.htm.php @@ -0,0 +1,72 @@ +<?php + +require_once("../config/inc_projects_config.php"); +require_once("../classes/project.class.php"); +require_once("../classes/formgen.class.php"); + +require_once("inc_functions.php"); + +$sOut='<h1>Build</h1>'; +$sError=''; + +// --- Checks +if (!array_key_exists("prj", $aParams)){ + $sError.='<li>Es wurde kein Projekt angegeben.</li>'; +} + + +if ($sError){ + $sOut.='<i class="icon-exclamation-sign"></i> FEHLER:<ul>'.$sError.'</ul>'; + +} else { + $oPrj=new project($aParams["prj"]); + + $sAction="default"; + if (array_key_exists("action", $aParams)){ + $sAction=$aParams["action"]; + } + + $sOut='<h1>Build :: '.$oPrj->getLabel().'</h1> + <p>' . $oPrj->getDescription() . '</p> + <hr> + '; + + switch ($sAction) { + case "build": + $sOut.=$oPrj->build(); + // $sOut.=execAndSend("dir /s /b " . $aConfig['workDir']); + + break; + + default: + $sNext=$oPrj->getNextPhase(); + $sOut.=' + <p> + Es wird ein neues Paket erstellt und auf die Phase <em class="'.$sNext.'">'.$sNext.'</em> installiert.<br> + Du kannst einen Kommentar zu diesem Deployment angeben und darin beschreiben, worin das Update + besteht (Fix, neue Funktion, ...). + </p> + '; + + // Eingabe Kommentare zum Deployment + //$oForm=new formgen(); + $sOut.=' + <hr> + <form action="?" enctype="multipart/form-data"> + <input type="hidden" name="prj" value="'.$_GET["prj"].'"> + <input type="hidden" name="action" value="build"> + ' . enterDeployinfos() . ' + <hr> + <input type="submit" class="btn btn-primary" value="Paket für ['.$sNext.'] erstellen"> + </form> + '; + break; + } +} +$sOut.=aHome(); + + +// -- Ausgabe +$sPhpOut=$sOut; +?> + diff --git a/00_demo/deploy.htm b/public_html/deployment/webgui/deploy.htm similarity index 100% rename from 00_demo/deploy.htm rename to public_html/deployment/webgui/deploy.htm diff --git a/00_demo/deploy.htm.php b/public_html/deployment/webgui/deploy.htm.php similarity index 100% rename from 00_demo/deploy.htm.php rename to public_html/deployment/webgui/deploy.htm.php diff --git a/00_demo/doc.htm b/public_html/deployment/webgui/doc.htm similarity index 100% rename from 00_demo/doc.htm rename to public_html/deployment/webgui/doc.htm diff --git a/00_demo/doc.htm.php b/public_html/deployment/webgui/doc.htm.php similarity index 100% rename from 00_demo/doc.htm.php rename to public_html/deployment/webgui/doc.htm.php diff --git a/00_demo/functions.js b/public_html/deployment/webgui/functions.js similarity index 100% rename from 00_demo/functions.js rename to public_html/deployment/webgui/functions.js diff --git a/00_demo/inc_config.php b/public_html/deployment/webgui/inc_config.php similarity index 94% rename from 00_demo/inc_config.php rename to public_html/deployment/webgui/inc_config.php index 21920b0e4b0a426a2f6fd21d33a9a7fc39012692..3b0753ada4cf6943fb70deeb9a6c2282fa5c7d53 100644 --- a/00_demo/inc_config.php +++ b/public_html/deployment/webgui/inc_config.php @@ -21,7 +21,7 @@ $aCfg=array( ), "doc.htm"=>array( "title"=>"Doc", - "class"=>"icon-forward", + "class"=>"icon-book", ), ), ); \ No newline at end of file diff --git a/00_demo/inc_functions.php b/public_html/deployment/webgui/inc_functions.php similarity index 59% rename from 00_demo/inc_functions.php rename to public_html/deployment/webgui/inc_functions.php index 88e775400e60181abfd553f3ab2b47cc052cdaa8..8f1b0bb0cfbbeffcbda17b462bf911d49bf87971 100644 --- a/00_demo/inc_functions.php +++ b/public_html/deployment/webgui/inc_functions.php @@ -1,5 +1,9 @@ <?php +global $aParams; +$aParams=array(); +if (count($_GET)) foreach($_GET as $key=>$value) $aParams[$key]=$value; +if (count($_POST)) foreach($_POST as $key=>$value) $aParams[$key]=$value; /** * get link as home button @@ -11,17 +15,23 @@ function aHome(){ function enterDeployinfos(){ + global $aParams; + $sIdUser="inputUser"; + $sIdComment="inputComment"; + $sUser=(array_key_exists($sIdUser, $aParams))?$aParams[$sIdUser]:""; + $sComment=(array_key_exists($sIdComment, $aParams))?$aParams[$sIdComment]:""; + $sOut=' <div class="control-group"> <label class="control-label" for="inputUser">Benutzername</label> <div class="controls"> - <input type="text" id="inputUser" placeholder="Benutzername"> + <input type="text" id="inputUser" name="inputUser" placeholder="Benutzername" value="'.$sUser.'"> </div> </div> <div class="control-group"> <label class="control-label" for="inputComment">Kommentar zum Deployment</label> <div class="controls"> - <textarea id= rows="3" id="inputComment" placeholder="Kommentar"></textarea> + <textarea id= rows="3" id="inputComment" name="inputComment" placeholder="Kommentar">'.$sComment.'</textarea> </div> </div> '; @@ -45,8 +55,10 @@ function showPhases($sCurrentPhase=false, $sNext=false){ } function execAndSend($sCommand){ + $sReturn=''; + $bUseHtml=$_SERVER?true:false; + ob_implicit_flush(true);ob_end_flush(); - $descriptorspec = array( 0 => array("pipe", "r"), // stdin is a pipe that the child will read from 1 => array("pipe", "w"), // stdout is a pipe that the child will write to @@ -54,14 +66,21 @@ function execAndSend($sCommand){ ); flush(); $process = proc_open($sCommand, $descriptorspec, $pipes, realpath('./'), array()); - echo "<pre>"; + + $sReturn.="[".date("H:i:s d.m.Y")."] $sCommand"; + $sReturn.=$bUseHtml?"<br><pre>":"\n"; + if (is_resource($process)) { + $oStatus = proc_get_status($process); while ($s = fgets($pipes[1])) { - print $s; + $sReturn.=$s; flush(); } } - echo "</pre>"; + $sReturn.=$bUseHtml?"</pre>":"\n"; + $sReturn.="[".date("H:i:s d.m.Y")."] finished; rc=".$oStatus['exitcode']; + $sReturn.=$bUseHtml?"<hr>":"\n---------\n"; + return $sReturn; } ?> diff --git a/00_demo/index.htm b/public_html/deployment/webgui/index.htm similarity index 100% rename from 00_demo/index.htm rename to public_html/deployment/webgui/index.htm diff --git a/00_demo/index.htm.php b/public_html/deployment/webgui/index.htm.php similarity index 100% rename from 00_demo/index.htm.php rename to public_html/deployment/webgui/index.htm.php