From bf41d24477d0d13f2bdb1cc87f645ef9f1f4de7b Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 19 Jun 2006 02:34:25 +0000 Subject: Added phing --- buildscripts/phing/tasks/ManualIndexTask.php | 38 +++++++ buildscripts/phing/tasks/PradoDocTask.php | 137 +++++++++++++++++++++++ buildscripts/phing/tasks/PradoPearTask.php | 133 ++++++++++++++++++++++ buildscripts/phing/tasks/PradoTestTask.php | 18 +++ buildscripts/phing/tasks/PradoVersionTask.php | 52 +++++++++ buildscripts/phing/tasks/QuickstartIndexTask.php | 32 ++++++ 6 files changed, 410 insertions(+) create mode 100644 buildscripts/phing/tasks/ManualIndexTask.php create mode 100644 buildscripts/phing/tasks/PradoDocTask.php create mode 100644 buildscripts/phing/tasks/PradoPearTask.php create mode 100644 buildscripts/phing/tasks/PradoTestTask.php create mode 100644 buildscripts/phing/tasks/PradoVersionTask.php create mode 100644 buildscripts/phing/tasks/QuickstartIndexTask.php (limited to 'buildscripts/phing/tasks') diff --git a/buildscripts/phing/tasks/ManualIndexTask.php b/buildscripts/phing/tasks/ManualIndexTask.php new file mode 100644 index 00000000..5b0febc6 --- /dev/null +++ b/buildscripts/phing/tasks/ManualIndexTask.php @@ -0,0 +1,38 @@ +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 @@ +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 @@ +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 @@ + \ 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..dfa0f578 --- /dev/null +++ b/buildscripts/phing/tasks/PradoVersionTask.php @@ -0,0 +1,52 @@ +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 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 @@ +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 -- cgit v1.2.3