From 588727c7e2b8954ec3dbde293cf4c4d68b119f9b Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 19 Jun 2006 18:38:29 +0000 Subject: Merge from 3.0 branch till 1185. --- buildscripts/phing/tasks/PradoVersionTask.php | 56 +++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 buildscripts/phing/tasks/PradoVersionTask.php (limited to 'buildscripts/phing/tasks/PradoVersionTask.php') diff --git a/buildscripts/phing/tasks/PradoVersionTask.php b/buildscripts/phing/tasks/PradoVersionTask.php new file mode 100644 index 00000000..911b68d4 --- /dev/null +++ b/buildscripts/phing/tasks/PradoVersionTask.php @@ -0,0 +1,56 @@ +addProperty('prado.version',$this->getPradoVersion()); + $this->addProperty('prado.revision',$this->getPradoRevision()); + if(substr(PHP_OS, 0, 3) == 'WIN') + $this->addProperty('prado.winbuild','true'); + else + $this->addProperty('prado.winbuild','false'); + } + + /** + * @return string Prado version + */ + private function getPradoVersion() + { + $coreFile=dirname(__FILE__).'/../../../framework/PradoBase.php'; + if(is_file($coreFile)) + { + $contents=file_get_contents($coreFile); + $matches=array(); + if(preg_match('/public static function getVersion.*?return \'(.*?)\'/ms',$contents,$matches)>0) + return $matches[1]; + } + return 'unknown'; + } + + /** + * @return string Prado SVN revision + */ + private function getPradoRevision() + { + $svnPath=dirname(__FILE__).'/../../../.svn'; + if(is_file($svnPath.'/all-wcprops')) + $propFile=$svnPath.'/all-wcprops'; + else if(is_file($svnPath.'/dir-wcprops')) + $propFile=$svnPath.'/dir-wcprops'; + else + return 'unknown'; + $contents=file_get_contents($propFile); + if(preg_match('/\\/repos\\/prado\\/\\!svn\\/ver\\/(\d+)\\//ms',$contents,$matches)>0) + return $matches[1]; + else + return 'unknown'; + } +} + +?> \ No newline at end of file -- cgit v1.2.3