summaryrefslogtreecommitdiff
path: root/buildscripts/phing/tasks/PradoVersionTask.php
diff options
context:
space:
mode:
authorxue <>2006-06-19 02:34:25 +0000
committerxue <>2006-06-19 02:34:25 +0000
commitbf41d24477d0d13f2bdb1cc87f645ef9f1f4de7b (patch)
treec37ef0365d620724cf3301b3c8dc9005901d965a /buildscripts/phing/tasks/PradoVersionTask.php
parentb59ab2490b1bb82dc1d0b58d89584182b405d0a0 (diff)
Added phing
Diffstat (limited to 'buildscripts/phing/tasks/PradoVersionTask.php')
-rw-r--r--buildscripts/phing/tasks/PradoVersionTask.php52
1 files changed, 52 insertions, 0 deletions
diff --git a/buildscripts/phing/tasks/PradoVersionTask.php b/buildscripts/phing/tasks/PradoVersionTask.php
new file mode 100644
index 00000000..dfa0f578
--- /dev/null
+++ b/buildscripts/phing/tasks/PradoVersionTask.php
@@ -0,0 +1,52 @@
+<?php
+require_once 'phing/Task.php';
+include_once 'phing/tasks/system/PropertyTask.php';
+
+class PradoVersionTask extends PropertyTask
+{
+ /**
+ * Execute lint check against PhingFile or a FileSet
+ */
+ public function main()
+ {
+ $this->addProperty('prado.version',$this->getPradoVersion());
+ $this->addProperty('prado.revision',$this->getPradoRevision());
+ }
+
+ /**
+ * @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