summaryrefslogtreecommitdiff
path: root/buildscripts/phing/tasks
diff options
context:
space:
mode:
authorxue <>2006-06-19 18:38:29 +0000
committerxue <>2006-06-19 18:38:29 +0000
commit588727c7e2b8954ec3dbde293cf4c4d68b119f9b (patch)
treefdcc16181a20335547953ccf1550e0006c11bf28 /buildscripts/phing/tasks
parent127f78a4db3cc0fbbbb92f5b1abcfdce4a9af93b (diff)
Merge from 3.0 branch till 1185.
Diffstat (limited to 'buildscripts/phing/tasks')
-rw-r--r--buildscripts/phing/tasks/ManualIndexTask.php38
-rw-r--r--buildscripts/phing/tasks/PradoDocTask.php137
-rw-r--r--buildscripts/phing/tasks/PradoPearTask.php133
-rw-r--r--buildscripts/phing/tasks/PradoTestTask.php18
-rw-r--r--buildscripts/phing/tasks/PradoVersionTask.php56
-rw-r--r--buildscripts/phing/tasks/QuickstartIndexTask.php32
6 files changed, 414 insertions, 0 deletions
diff --git a/buildscripts/phing/tasks/ManualIndexTask.php b/buildscripts/phing/tasks/ManualIndexTask.php
new file mode 100644
index 00000000..1725880f
--- /dev/null
+++ b/buildscripts/phing/tasks/ManualIndexTask.php
@@ -0,0 +1,38 @@
+<?php
+
+require_once 'phing/Task.php';
+
+/**
+ * Task to index PRADO API docs.
+ */
+class ManualIndexTask extends Task
+{
+ private $docdir;
+ private $todir;
+
+ /**
+ * @param string the API documentation directory
+ */
+ public function setDocdir($value)
+ {
+ $this->docdir=$value;
+ }
+
+ public function setTodir($value)
+ {
+ $this->todir=$value;
+ }
+
+ public function main()
+ {
+ $srcdir=realpath(dirname(__FILE__).'/../../../');
+ $zend_path = $srcdir.'/demos/quickstart/protected/index';
+ set_include_path(get_include_path().PATH_SEPARATOR.realpath($zend_path));
+ require_once ('Zend/Search/Lucene.php');
+ require_once($srcdir.'/buildscripts/index/api_index.php');
+ $api = new api_index($this->todir, realpath($this->docdir));
+ $api->create_index();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoDocTask.php b/buildscripts/phing/tasks/PradoDocTask.php
new file mode 100644
index 00000000..3ab891bd
--- /dev/null
+++ b/buildscripts/phing/tasks/PradoDocTask.php
@@ -0,0 +1,137 @@
+<?php
+require_once 'phing/Task.php';
+
+/**
+ * Task to run phpDocumentor for PRADO API docs.
+ */
+class PradoDocTask extends Task
+{
+ private $phpdoc = 'phpdoc';
+
+ private $title = "Default Title";
+
+ private $destdir = ".";
+
+ private $sourcepath = NULL;
+
+ private $ignorelist = '';
+
+ private $output = "";
+
+ private $linksource = false;
+
+ private $parseprivate = false;
+
+ function setPhpdoc($phpdoc)
+ {
+ $this->phpdoc=$phpdoc;
+ }
+
+ /**
+ * Set the title for the generated documentation
+ */
+ function setTitle($title)
+ {
+ $this->title = $title;
+ }
+
+ /**
+ * Set the destination directory for the generated documentation
+ */
+ function setDestdir($destdir)
+ {
+ $this->destdir = $destdir;
+ }
+
+ /**
+ * Set the source path
+ */
+ function setSourcepath(Path $sourcepath)
+ {
+ if ($this->sourcepath === NULL)
+ {
+ $this->sourcepath = $sourcepath;
+ }
+ else
+ {
+ $this->sourcepath->append($sourcepath);
+ }
+ }
+
+ /**
+ * Set the output type
+ */
+ function setOutput($output)
+ {
+ $this->output = $output;
+ }
+
+ /**
+ * Should sources be linked in the generated documentation
+ */
+ function setLinksource($linksource)
+ {
+ $this->linksource = $linksource;
+ }
+
+ function setIgnorelist($ignorelist)
+ {
+ $this->ignorelist=$ignorelist;
+ }
+
+ /**
+ * Main entrypoint of the task
+ */
+ function main()
+ {
+ $arguments = $this->constructArguments();
+ exec($this->phpdoc . " " . $arguments, $output, $retval);
+ }
+
+ /**
+ * Constructs an argument string for phpDocumentor
+ */
+ private function constructArguments()
+ {
+ $arguments = "-q \"on\" ";
+
+ if ($this->title)
+ {
+ $arguments.= "-ti \"" . $this->title . "\" ";
+ }
+
+ if ($this->destdir)
+ {
+ $arguments.= "-t \"" . $this->destdir . "\" ";
+ }
+
+ if ($this->sourcepath !== NULL)
+ {
+ $arguments.= "-d \"" . $this->sourcepath->__toString() . "\" ";
+ }
+
+ if ($this->output)
+ {
+ $arguments.= "-o \"" . $this->output . "\" ";
+ }
+
+ if ($this->linksource)
+ {
+ $arguments.= "-s ";
+ }
+
+ if ($this->parseprivate)
+ {
+ $arguments.= "-pp ";
+ }
+
+ if ($this->ignorelist)
+ {
+ $arguments.='-i "'.$this->ignorelist.'" ';
+ }
+
+ return $arguments;
+ }
+}
+
+?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoPearTask.php b/buildscripts/phing/tasks/PradoPearTask.php
new file mode 100644
index 00000000..5d615084
--- /dev/null
+++ b/buildscripts/phing/tasks/PradoPearTask.php
@@ -0,0 +1,133 @@
+<?php
+
+require_once 'phing/Task.php';
+require_once('PEAR/PackageFileManager2.php');
+
+/**
+ * Task to run phpDocumentor for PRADO API docs.
+ */
+class PradoPearTask extends Task
+{
+ private $pkgdir;
+ private $channel;
+ private $version;
+ private $state;
+ private $category;
+ private $package;
+ private $summary;
+ private $pkgdescription;
+ private $notes;
+ private $license;
+
+ function setPkgdir($value)
+ {
+ $this->pkgdir=$value;
+ }
+
+ function setChannel($value)
+ {
+ $this->channel=$value;
+ }
+
+ function setVersion($value)
+ {
+ $this->version=$value;
+ }
+
+ function setState($value)
+ {
+ $this->state=$value;
+ }
+
+ function setCategory($value)
+ {
+ $this->category=$value;
+ }
+
+ function setPackage($value)
+ {
+ $this->package=$value;
+ }
+
+ function setSummary($value)
+ {
+ $this->summary=$value;
+ }
+
+ function setPkgdescription($value)
+ {
+ $this->pkgdescription=$value;
+ }
+
+ function setNotes($value)
+ {
+ $this->notes=$value;
+ }
+
+ function setLicense($value)
+ {
+ $this->license=$value;
+ }
+
+ /**
+ * Main entrypoint of the task
+ */
+ function main()
+ {
+ $pkg = new PEAR_PackageFileManager2();
+
+ $e = $pkg->setOptions(
+ array(
+ 'baseinstalldir' => 'prado',
+ 'packagedirectory' => $this->pkgdir,
+ 'pathtopackagefile' => $this->pkgdir,
+ 'filelistgenerator' => 'file',
+ 'simpleoutput' => true,
+ 'ignore' => array(),
+ 'dir_roles' =>
+ array(
+ 'docs' => 'doc',
+ 'examples' => 'doc',
+ 'framework' => 'php',
+ 'framework/js' => 'doc',
+ 'framework/3rdParty' => 'doc',
+ ),
+ 'exceptions' =>
+ array(
+ 'requirements.php' => 'doc',
+ ),
+ )
+ );
+
+ // PEAR error checking
+ if (PEAR::isError($e))
+ die($e->getMessage());
+ $pkg->setPackage($this->package);
+ $pkg->setSummary($this->summary);
+ $pkg->setDescription($this->pkgdescription);
+ $pkg->setChannel($this->channel);
+
+ $pkg->setReleaseStability($this->state);
+ $pkg->setAPIStability($this->state);
+ $pkg->setReleaseVersion($this->version);
+ $pkg->setAPIVersion($this->version);
+
+ $pkg->setLicense($this->license);
+ $pkg->setNotes($this->notes);
+ $pkg->setPackageType('php');
+ $pkg->setPhpDep('5.0.0');
+ $pkg->setPearinstallerDep('1.4.2');
+
+ $pkg->addRelease();
+ $pkg->addMaintainer('lead','qxue','Qiang (Charlie) Xue','qiang.xue@gmail.com');
+
+ $test = $pkg->generateContents();
+
+ $e = $pkg->writePackageFile();
+
+ if (PEAR::isError($e))
+ echo $e->getMessage();
+ }
+}
+
+?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoTestTask.php b/buildscripts/phing/tasks/PradoTestTask.php
new file mode 100644
index 00000000..ba1e06be
--- /dev/null
+++ b/buildscripts/phing/tasks/PradoTestTask.php
@@ -0,0 +1,18 @@
+<?php
+require_once 'phing/Task.php';
+require_once 'phing/tasks/ext/phpunit2/PHPUnit2Task.php';
+
+/**
+ * Task to run PRADO unit tests
+ */
+class PradoTestTask extends PHPUnit2Task
+{
+ function init()
+ {
+ $phpunit2_path = realpath(dirname(__FILE__).'/../..');
+ set_include_path(get_include_path().PATH_SEPARATOR.$phpunit2_path);
+ parent::init();
+ }
+}
+
+?> \ No newline at end of file
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 @@
+<?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());
+ 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
diff --git a/buildscripts/phing/tasks/QuickstartIndexTask.php b/buildscripts/phing/tasks/QuickstartIndexTask.php
new file mode 100644
index 00000000..f3107fd3
--- /dev/null
+++ b/buildscripts/phing/tasks/QuickstartIndexTask.php
@@ -0,0 +1,32 @@
+<?php
+
+require_once 'phing/Task.php';
+
+/**
+ * Task to index quickstart
+ */
+class QuickstartIndexTask extends Task
+{
+ private $todir;
+
+ public function setTodir($value)
+ {
+ $this->todir=$value;
+ }
+
+ public function main()
+ {
+ $srcdir=realpath(dirname(__FILE__).'/../../../');
+ $zend_path = $srcdir.'/demos/quickstart/protected/index';
+ set_include_path(get_include_path().PATH_SEPARATOR.realpath($zend_path));
+ require_once ('Zend/Search/Lucene.php');
+
+ require_once($srcdir.'/buildscripts/index/quickstart_index.php');
+ $quickstart_source = $srcdir.'/buildscripts/texbuilder/pages.php';
+ $quickstart_base = $srcdir.'/demos/quickstart/protected/pages/';
+ $quickstart = new quickstart_index($this->todir, realpath($quickstart_base), realpath($quickstart_source));
+ $quickstart->create_index();
+ }
+}
+
+?> \ No newline at end of file