summaryrefslogtreecommitdiff
path: root/buildscripts/phing/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'buildscripts/phing/tasks')
-rw-r--r--buildscripts/phing/tasks/BuildPradoPEARPackageTask.php205
-rw-r--r--buildscripts/phing/tasks/ManualIndexTask.php2
-rw-r--r--buildscripts/phing/tasks/PradoDocTask.php17
-rw-r--r--buildscripts/phing/tasks/PradoPackageTask.php142
-rw-r--r--buildscripts/phing/tasks/PradoQuickStartDocs.php85
-rw-r--r--buildscripts/phing/tasks/PradoSimpleTestTask.php40
-rw-r--r--buildscripts/phing/tasks/PradoTestTask.php13
-rw-r--r--buildscripts/phing/tasks/PradoVersionTask.php2
-rw-r--r--buildscripts/phing/tasks/QuickstartIndexTask.php2
9 files changed, 8 insertions, 500 deletions
diff --git a/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php b/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php
deleted file mode 100644
index a8128d12..00000000
--- a/buildscripts/phing/tasks/BuildPradoPEARPackageTask.php
+++ /dev/null
@@ -1,205 +0,0 @@
-<?php
-require_once 'phing/tasks/system/MatchingTask.php';
-include_once 'phing/types/FileSet.php';
-include_once 'phing/tasks/ext/pearpackage/Fileset.php';
-require_once 'PEAR/PackageFileManager.php';
-require_once 'PEAR/PackageFileManager/File.php';
-
-/**
- * Task for creating a PEAR package definition file package.xml to be used with
- * the PEAR distribution of PRADO.
- *
- * @author Knut Urdalen <knut.urdalen@gmail.com>
- * @package phing.tasks.ext
- */
-class BuildPradoPEARPackageTask extends MatchingTask {
-
- /* Base directory for reading files. */
- private $dir;
-
- /* PRADO version */
- private $version;
-
- /* PRADO state */
- private $state = 'stable';
- private $notes;
- private $filesets = array();
-
- /* Package file */
- private $packageFile;
-
- /**
- * Intitialize the task and throw a BuildException if something is missing.
- */
- public function init() {
- include_once 'PEAR/PackageFileManager2.php';
- if(!class_exists('PEAR_PackageFileManager2')) {
- throw new BuildException("You must have installed PEAR_PackageFileManager2 (PEAR_PackageFileManager >= 1.6.0) in order to create a PEAR package.xml file.");
- }
- }
-
- /**
- * Helper function to set PEAR package options.
- *
- * @param PEAR_PackageFileManager2 $pkg
- */
- private function setOptions($pkg) {
- $options['baseinstalldir'] = 'prado3';
- $options['packagedirectory'] = $this->dir->getAbsolutePath();
-
- if(empty($this->filesets)) {
- throw new BuildException("You must use a <fileset> tag to specify the files to include in the package.xml");
- }
-
- // Use PEAR_PackageFileManager_Fileset from phing as file list generator
- $options['filelistgenerator'] = 'Fileset';
-
- // Some Phing-specific options needed by our Fileset reader
- $options['phing_project'] = $this->getProject();
- $options['phing_filesets'] = $this->filesets;
-
- if($this->packageFile !== null) {
- // Create one with full path
- $f = new PhingFile($this->packageFile->getAbsolutePath());
- $options['packagefile'] = $f->getName();
- // Must end in trailing slash
- $options['outputdirectory'] = $f->getParent().DIRECTORY_SEPARATOR;
- $this->log("Creating package file: ".$f->getPath(), PROJECT_MSG_INFO);
- } else {
- $this->log("Creating [default] package.xml file in base directory.", PROJECT_MSG_INFO);
- }
- $options['dir_roles'] = array('framework' => 'php');
- $pkg->setOptions($options);
- }
-
- /**
- * Main entry point.
- * @return void
- */
- public function main() {
-
- if($this->dir === null) {
- throw new BuildException("You must specify the \"dir\" attribute for PEAR package task.");
- }
-
- if($this->version === null) {
- throw new BuildException("You must specify the \"version\" attribute for PEAR package task.");
- }
-
- $package = new PEAR_PackageFileManager2();
- $this->setOptions($package);
-
- // the hard-coded stuff
- $package->setPackage('prado3');
- $package->setSummary('PRADO is a component-based and event-driven framework for rapid Web programming in PHP 5.');
- $package->setDescription('PRADO reconceptualizes Web application development in terms of components, events and properties instead of procedures, URLs and query parameters.
-
-A PRADO component is a combination of a specification file (in XML), an HTML template and a PHP class. PRADO components are combined together to form larger components or complete PRADO pages.
-
-Developing PRADO Web applications mainly involves instantiating prebuilt and application-specific component types, configuring them by setting their properties, responding to their events by writing handler functions, and composing them into application tasks. Event-driven programming
-
-PRADO provides the following benefits for Web application developers:
-
-o Reusability - Codes following the PRADO component protocol are highly reusable. Everything in PRADO is a reusable component.
-o Ease of Use - Creating and using components are extremely easy. Usually they simply involve configuring component properties.
-o Robustness - PRADO frees developers from writing boring, buggy code. They code in terms of objects, methods and properties, instead of URLs and query parameters. The latest PHP5 exception mechanism is exploited that enables line-precise error reporting.
-o Performance - PRADO uses a cache technique to ensure the performance of applications based on it. The performance is in fact comparable to those based on commonly used template engines.
-o Team Integration - PRADO enables separation of content and presentation. Components, typically pages, have their content (logic) and presentation stored in different files.');
- $package->setChannel('pear.pradosoft.com');
- $package->setPackageType('php');
-
- $package->setReleaseVersion($this->version);
- $package->setAPIVersion($this->version);
-
- $package->setReleaseStability($this->state);
- $package->setAPIStability($this->state);
-
- $package->setNotes($this->notes);
-
- $package->setLicense('BSD', 'http://www.opensource.org/licenses/bsd-license.php');
-
- // Add package maintainers
- $package->addMaintainer('lead', 'qxue', 'Qiang Xue', 'qiang.xue@gmail.com');
- $package->addMaintainer('lead', 'jrags', 'Jason Ragsdale', 'jrags@jasrags.net');
- $package->addMaintainer('lead', 'knut', 'Knut Urdalen', 'knut.urdalen@gmail.com');
-
- // "core" dependencies
- $package->setPhpDep('5.1.0');
- $package->setPearinstallerDep('1.4.7');
-
- $package->generateContents();
-
- $e = $package->writePackageFile();
-
- if(PEAR::isError($e)) {
- throw new BuildException("Unable to write package file.", new Exception($e->getMessage()));
- }
- }
-
- /**
- * Used by the PEAR_PackageFileManager_PhingFileSet lister.
- * @return array FileSet[]
- */
- public function getFileSets() {
- return $this->filesets;
- }
-
- // -------------------------------
- // Set properties from XML
- // -------------------------------
-
- /**
- * Nested creator, creates a FileSet for this task
- *
- * @return FileSet The created fileset object
- */
- function createFileSet() {
- $num = array_push($this->filesets, new FileSet());
- return $this->filesets[$num-1];
- }
-
- /**
- * Set the version we are building.
- * @param string $v
- * @return void
- */
- public function setVersion($v){
- $this->version = $v;
- }
-
- /**
- * Set the state we are building.
- * @param string $v
- * @return void
- */
- public function setState($v) {
- $this->state = $v;
- }
-
- /**
- * Sets release notes field.
- * @param string $v
- * @return void
- */
- public function setNotes($v) {
- $this->notes = $v;
- }
- /**
- * Sets "dir" property from XML.
- * @param PhingFile $f
- * @return void
- */
- public function setDir(PhingFile $f) {
- $this->dir = $f;
- }
-
- /**
- * Sets the file to use for generated package.xml
- */
- public function setDestFile(PhingFile $f) {
- $this->packageFile = $f;
- }
-
-}
-
-
diff --git a/buildscripts/phing/tasks/ManualIndexTask.php b/buildscripts/phing/tasks/ManualIndexTask.php
index c689d4c5..3590a500 100644
--- a/buildscripts/phing/tasks/ManualIndexTask.php
+++ b/buildscripts/phing/tasks/ManualIndexTask.php
@@ -34,5 +34,3 @@ class ManualIndexTask extends Task
$api->create_index();
}
}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoDocTask.php b/buildscripts/phing/tasks/PradoDocTask.php
index 944fde82..449ff711 100644
--- a/buildscripts/phing/tasks/PradoDocTask.php
+++ b/buildscripts/phing/tasks/PradoDocTask.php
@@ -16,7 +16,7 @@ class PradoDocTask extends Task
private $ignorelist = '';
- private $output = "";
+ private $template = "";
private $linksource = false;
@@ -66,11 +66,11 @@ class PradoDocTask extends Task
}
/**
- * Set the output type
+ * Set the template
*/
- function setOutput($output)
+ function setTemplate($template)
{
- $this->output = $output;
+ $this->template = $template;
}
/**
@@ -92,6 +92,7 @@ class PradoDocTask extends Task
function main()
{
$arguments = $this->constructArguments();
+ echo $this->phpdoc . " " . $arguments."\n";
passthru($this->phpdoc . " " . $arguments, $retval);
}
@@ -109,7 +110,7 @@ class PradoDocTask extends Task
if ($this->title)
{
- $arguments.= "-ti \"" . $this->title . "\" ";
+ $arguments.= "--title \"" . $this->title . "\" ";
}
if ($this->destdir)
@@ -122,9 +123,9 @@ class PradoDocTask extends Task
$arguments.= "-d \"" . $this->sourcepath->__toString() . "\" ";
}
- if ($this->output)
+ if ($this->template)
{
- $arguments.= "-o \"" . $this->output . "\" ";
+ $arguments.= "--template \"" . $this->template . "\" ";
}
if ($this->linksource)
@@ -145,5 +146,3 @@ class PradoDocTask extends Task
return $arguments;
}
}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoPackageTask.php b/buildscripts/phing/tasks/PradoPackageTask.php
deleted file mode 100644
index 61031206..00000000
--- a/buildscripts/phing/tasks/PradoPackageTask.php
+++ /dev/null
@@ -1,142 +0,0 @@
-<?php
-require_once 'phing/Task.php';
-
-/**
- * Task to run phpDocumentor for PRADO API docs.
- */
-class PradoPackageTask extends Task
-{
- protected $filelists = array();
- protected $output;
- protected $strip=false;
-
- function setOutput(PhingFile $file)
- {
- $this->output=$file;
- }
-
- function setStrip($value)
- {
- $this->strip = (boolean)$value;
- }
-
- /**
- * Supports embedded <filelist> element.
- * @return FileList
- */
- function createFileList() {
- $num = array_push($this->filelists, new FileList());
- return $this->filelists[$num-1];
- }
-
- function main()
- {
- $project = $this->getProject();
-
- $content = '';
- $files=array();
- // append the files in the filelists
- foreach($this->filelists as $fl)
- {
- $fromDir = $fl->getDir($project);
- foreach($fl->getFiles($project) as $file)
- {
- $src = new PhingFile($fromDir,$file);
- $files[] = $file;
- $content .= file_get_contents($src->getAbsolutePath());
- }
- }
-
- $content = $this->processPhp($content,$files);
- file_put_contents($this->output->getAbsolutePath(), $content);
- }
-
- function processPhp($content,$files)
- {
- $content = preg_replace('/^\s*Prado::trace.*\s*;\s*$/mu','',$content);
- $content = preg_replace('/(PradoBase::using|Prado::using|require_once|include_once)\s*\([^\$].*?\);/mu','',$content);
- $content = str_replace('Prado::', 'PradoBase::', $content);
- $content = str_replace('PradoBase::getApplication()->getMode()', 'true', $content);
- $content = str_replace('TApplicationMode::Debug', 'true', $content);
- $content = str_replace('/Exceptions/messages', '/messages', $content);
- if($this->strip)
- $content=$this->strip_comments($content);
- $content=$this->strip_empty_lines($content);
- $content="<?php".$this->getFileComment($files).preg_replace('/(\?>\s?|<\?php\s?)/mu','',$content)."\n?>";
- return $content;
- }
-
-function strip_comments($source)
-{
- $tokens = token_get_all($source);
- /* T_ML_COMMENT does not exist in PHP 5.
- * The following three lines define it in order to
- * preserve backwards compatibility.
- *
- * The next two lines define the PHP 5-only T_DOC_COMMENT,
- * which we will mask as T_ML_COMMENT for PHP 4.
- */
- if (!defined('T_ML_COMMENT')) {
- @define('T_ML_COMMENT', T_COMMENT);
- } else {
- @define('T_DOC_COMMENT', T_ML_COMMENT);
- }
- $output = '';
- foreach ($tokens as $token) {
- if (is_string($token)) {
- // simple 1-character token
- $output .= $token;
- } else {
- // token array
- list($id, $text) = $token;
- switch ($id) {
- case T_COMMENT:
- case T_ML_COMMENT: // we've defined this
- case T_DOC_COMMENT: // and this
- // no action on comments
- break;
- default:
- // anything else -> output "as is"
- $output .= $text;
- break;
- }
- }
- }
- return $output;
-}
-
-function strip_empty_lines($string)
-{
- $string = preg_replace("/[\r\n]+[\s\t]*[\r\n]+/", "\n", $string);
- $string = preg_replace("/^[\s\t]*[\r\n]+/", "", $string);
- return $string;
-}
-function getFileComment($files)
-{
- $lastupdate=date('Y/m/d H:i:s');
- $year=date('Y');
- $fileList=array();
- foreach($files as $file)
- $fileList[] = " * $file";
- $fileListStr = implode("\n", $fileList);
-$comments="
-/**
- * Last Update: $lastupdate
- *
- * Do not modify this file manually. This file was auto-generated by combining
- * the following classes from the Prado framework.
- *
- * Files:
-{$fileListStr}
- *
- * @author Qiang Xue <qiang.xue@gmail.com>, Wei Zhuo <weizhuo@gmail.com>
- * @link http://www.pradosoft.com/
- * @copyright Copyright &copy; 2005-{$year} PradoSoft
- * @license http://www.pradosoft.com/license/
- */
-
-";
- return $comments;
-}
-}
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoQuickStartDocs.php b/buildscripts/phing/tasks/PradoQuickStartDocs.php
deleted file mode 100644
index 1cbc5140..00000000
--- a/buildscripts/phing/tasks/PradoQuickStartDocs.php
+++ /dev/null
@@ -1,85 +0,0 @@
-<?php
-require_once 'phing/Task.php';
-
-require_once(dirname(__FILE__).'/../../chmbuilder/ChmQuickstartBuilder.php');
-include(dirname(__FILE__).'/../../../framework/PradoBase.php');
-class Prado extends PradoBase
-{
- protected static $app;
-
- public static function setApplication($application)
- {
- self::$app=$application;
- }
-
- public static function getApplication()
- {
- return self::$app;
- }
-
- public static function setPathOfAlias($alias,$path)
- {
- $aliases = self::getPathAliases();
- if(!isset($aliases[$alias]))
- parent::setPathOfAlias($alias,$path);
- }
-}
-
-include(dirname(__FILE__).'/../../../framework/prado.php');
-
-/**
- * Task to run phpDocumentor for PRADO API docs.
- */
-class PradoQuickStartDocs extends Task
-{
- private $base_dir;
-
- private $destdir;
-
- private $page;
-
- /**
- * Set the destination directory for the generated documentation
- */
- function setOutput(PhingFile $destdir)
- {
- $this->destdir = $destdir;
- }
-
- function setPages($page)
- {
- $this->page = $page;
- }
-
- /**
- * Main entrypoint of the task
- */
- function main()
- {
- $output = $this->destdir->getAbsolutePath();
- $base = dirname(__FILE__).'/../../../demos/quickstart/protected/';
- error_reporting(0);
- $quickstart= new ChmQuickstartBuilder($base,$output);
-
- foreach(preg_split('/\s*[, ]+\s*/', $this->page) as $page)
- {
- $file = str_replace(array('/','.page'), array('_','.html'),$page);
- $this->log("Parsing $page");
- file_put_contents($output.'/'.$file, $this->parsePage($quickstart,$page));
- $this->log("Writing $file");
- }
- }
-
- protected function parsePage($quickstart, $page)
- {
- $_GET['page'] = str_replace(array('/','.page'),array('.',''),$page);
- $_GET['notheme'] = 'true';
- $content = $quickstart->parseHtmlContent($quickstart->getApplicationContent());
- //hide prado specific content
- $content = str_replace('<body>', '<style type="text/css">.prado-specific {display:none;}</style><body>', $content);
- return $content;
- }
-
-}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoSimpleTestTask.php b/buildscripts/phing/tasks/PradoSimpleTestTask.php
deleted file mode 100644
index 91e6e22f..00000000
--- a/buildscripts/phing/tasks/PradoSimpleTestTask.php
+++ /dev/null
@@ -1,40 +0,0 @@
-<?php
-require_once 'phing/Task.php';
-require_once 'phing/tasks/ext/simpletest/SimpleTestTask.php';
-
-/**
- * Task to run PRADO unit tests
- */
-class PradoSimpleTestTask extends SimpleTestTask
-{
- private $_appdir;
-
- public function setAppdir($value)
- {
- $this->_appdir=$value;
- }
-
- function init()
- {
- $tools= realpath(dirname(__FILE__).'/../../../tests/test_tools/');
- include_once "$tools/unit_tests.php";
-
- if (!class_exists('SimpleReporter',false))
- throw new BuildException("SimpleTestTask depends on SimpleTest package being installed.", $this->getLocation());
-
- require_once 'phing/tasks/ext/simpletest/SimpleTestCountResultFormatter.php';
- require_once 'phing/tasks/ext/simpletest/SimpleTestFormatterElement.php';
- }
-
- function main()
- {
- if($this->_appdir)
- {
- $app = new TShellApplication($this->_appdir);
- $app->run();
- }
- parent::main();
- }
-}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoTestTask.php b/buildscripts/phing/tasks/PradoTestTask.php
deleted file mode 100644
index a52e7c85..00000000
--- a/buildscripts/phing/tasks/PradoTestTask.php
+++ /dev/null
@@ -1,13 +0,0 @@
-<?php
-require_once 'phing/Task.php';
-require_once 'phing/tasks/ext/phpunit/PHPUnitTask.php';
-require 'PHPUnit/Autoload.php';
-
-/**
- * Task to run PRADO unit tests
- */
-class PradoTestTask extends PHPUnitTask
-{
-}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/PradoVersionTask.php b/buildscripts/phing/tasks/PradoVersionTask.php
index 2a76d97c..4310cf60 100644
--- a/buildscripts/phing/tasks/PradoVersionTask.php
+++ b/buildscripts/phing/tasks/PradoVersionTask.php
@@ -52,5 +52,3 @@ class PradoVersionTask extends PropertyTask
return 'unknown';
}
}
-
-?> \ No newline at end of file
diff --git a/buildscripts/phing/tasks/QuickstartIndexTask.php b/buildscripts/phing/tasks/QuickstartIndexTask.php
index 5179d8ad..1cea4b3e 100644
--- a/buildscripts/phing/tasks/QuickstartIndexTask.php
+++ b/buildscripts/phing/tasks/QuickstartIndexTask.php
@@ -28,5 +28,3 @@ class QuickstartIndexTask extends Task
$quickstart->create_index();
}
}
-
-?> \ No newline at end of file