CC-2166: Packaging Improvements. Moved the Zend app into airtime_mvc. It is now installed to /var/www/airtime. Storage is now set to /srv/airtime/stor. Utils are now installed to /usr/lib/airtime/utils/. Added install/airtime-dircheck.php as a simple test to see if everything is install/uninstalled correctly.
This commit is contained in:
parent
514777e8d2
commit
b11cbd8159
4546 changed files with 138 additions and 51 deletions
|
@ -0,0 +1,220 @@
|
|||
<?php
|
||||
/**
|
||||
* $Id: PhingPhpDocumentorSetup.php 905 2010-10-05 16:28:03Z mrook $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://phing.info>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Phing subclass of the phpDocumentor_setup class provided with PhpDocumentor to work around limitations in PhpDocumentor API.
|
||||
*
|
||||
* This class is necessary because phpDocumentor_setup does not expose a complete API for setting configuration options. Because
|
||||
* this class must directly modify some "private" GLOBAL(!) configuration variables, it is liable to break if the PhpDocumentor
|
||||
* internal implementation changes. Obviously this is far from ideal, but there's also no solution given the inflexibility of the
|
||||
* PhpDocumentor design.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>@author hans
|
||||
* @version $Id: PhingPhpDocumentorSetup.php 905 2010-10-05 16:28:03Z mrook $
|
||||
* @package phing.tasks.ext.phpdoc
|
||||
*/
|
||||
class PhingPhpDocumentorSetup extends phpDocumentor_setup {
|
||||
|
||||
/**
|
||||
* Constructs a new PhingPhpDocumentorSetup.
|
||||
*
|
||||
* @param string $configDir Directory in which to look for configuration files.
|
||||
*/
|
||||
public function __construct($configdir = null) {
|
||||
global $_phpDocumentor_cvsphpfile_exts, $_phpDocumentor_setting, $_phpDocumentor_phpfile_exts;
|
||||
|
||||
$this->setup = new Io();
|
||||
$this->render = new phpDocumentor_IntermediateParser("Default Title");
|
||||
|
||||
$GLOBALS['_phpDocumentor_install_dir'] = $configdir;
|
||||
$this->parseIni();
|
||||
|
||||
// These redundant-looking lines seem to actually make a difference.
|
||||
// See: http://phing.info/trac/ticket/150
|
||||
$_phpDocumentor_phpfile_exts = $GLOBALS['_phpDocumentor_phpfile_exts'];
|
||||
$_phpDocumentor_cvsphpfile_exts = $GLOBALS['_phpDocumentor_cvsphpfile_exts'];
|
||||
|
||||
if (tokenizer_ext) {
|
||||
$this->parse = new phpDocumentorTParser();
|
||||
} else {
|
||||
$this->parse = new Parser();
|
||||
}
|
||||
|
||||
$this->setMemoryLimit();
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to generate sourcecode for each file parsed.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param bool $b
|
||||
*/
|
||||
public function setGenerateSourcecode($b) {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['sourcecode'] = (boolean) $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array of README/INSTALL/CHANGELOG file paths.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param array $files Absolute paths to files.
|
||||
*/
|
||||
public function setRicFiles($files) {
|
||||
global $_phpDocumentor_RIC_files;
|
||||
$_phpDocumentor_RIC_files = $files;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set comma-separated list of tags to ignore.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param string $tags
|
||||
*/
|
||||
public function setIgnoreTags($tags) {
|
||||
global $_phpDocumentor_setting;
|
||||
$ignoretags = explode(',', $tags);
|
||||
$ignoretags = array_map('trim', $ignoretags);
|
||||
$tags = array();
|
||||
foreach($ignoretags as $tag) {
|
||||
if (!in_array($tag,array('@global', '@access', '@package', '@ignore', '@name', '@param', '@return', '@staticvar', '@var')))
|
||||
$tags[] = $tag;
|
||||
}
|
||||
$_phpDocumentor_setting['ignoretags'] = $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to parse dirs as PEAR repos.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param bool $b
|
||||
*/
|
||||
public function setPear($b) {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['pear'] = (boolean) $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set fullpath to directory to look in for examples.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param string $dir
|
||||
*/
|
||||
public function setExamplesDir($dir) {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['examplesdir'] = $dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default package name.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setDefaultPackageName($name) {
|
||||
$GLOBALS['phpDocumentor_DefaultPackageName'] = trim($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default category name.
|
||||
*
|
||||
* This method exists as a hack because there is no API exposed for this in PhpDocumentor.
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function setDefaultCategoryName($name) {
|
||||
$GLOBALS['phpDocumentor_DefaultCategoryName'] = trim($name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enables quiet mode.
|
||||
*
|
||||
* This method exists as a hack because the API exposed for this method in PhpDocumentor
|
||||
* doesn't work correctly.
|
||||
*
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with this value, this
|
||||
* is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
*/
|
||||
public function setQuietMode() {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['quiet'] = true;
|
||||
parent::setQuietMode();
|
||||
}
|
||||
|
||||
/**
|
||||
* Control whether or not warnings will be shown for undocumented elements.
|
||||
* Useful for identifying classes and methods that haven't yet been
|
||||
* documented.
|
||||
*
|
||||
* @param bool $bEnable
|
||||
*/
|
||||
public function setUndocumentedelements($bEnable) {
|
||||
$this->render->setUndocumentedElementWarningsMode($bEnable);
|
||||
}
|
||||
|
||||
/**
|
||||
* custom tags, will be recognized and put in tags[] instead of
|
||||
* unknowntags[]
|
||||
*
|
||||
* This method exists as a hack because the API exposed for this method in
|
||||
* PhpDocumentor doesn't work correctly.
|
||||
*
|
||||
* Note that because we are setting a "private" GLOBAL(!!) config var with
|
||||
* this value, this is subject to break if PhpDocumentor internals changes.
|
||||
*
|
||||
* @param string $sCustomtags
|
||||
*/
|
||||
public function setCustomtags($sCustomtags) {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['customtags'] = $sCustomtags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Files to ignore
|
||||
*
|
||||
* @param string $sIgnore
|
||||
*/
|
||||
public function setIgnore($sIgnore) {
|
||||
global $_phpDocumentor_setting;
|
||||
$_phpDocumentor_setting['ignore'] = $sIgnore;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,265 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* $Id: PhpDocumentorExternalTask.php 905 2010-10-05 16:28:03Z mrook $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://phing.info>.
|
||||
*/
|
||||
|
||||
require_once 'phing/tasks/ext/phpdoc/PhpDocumentorTask.php';
|
||||
|
||||
/**
|
||||
* Task to run phpDocumentor with an external process
|
||||
*
|
||||
* This classes uses the commandline phpdoc script to build documentation.
|
||||
* Use this task instead of the PhpDocumentorTask when you've a clash with the
|
||||
* Smarty libraries.
|
||||
*
|
||||
* @author Michiel Rook <michiel.rook@gmail.com>
|
||||
* @author Markus Fischer <markus@fischer.name>
|
||||
* @version $Id: PhpDocumentorExternalTask.php 905 2010-10-05 16:28:03Z mrook $
|
||||
* @package phing.tasks.ext.phpdoc
|
||||
*/
|
||||
class PhpDocumentorExternalTask extends PhpDocumentorTask
|
||||
{
|
||||
/**
|
||||
* The path to the executable for phpDocumentor
|
||||
*/
|
||||
protected $programPath = 'phpdoc';
|
||||
|
||||
protected $sourcepath = NULL;
|
||||
|
||||
/**
|
||||
* @var bool ignore symlinks to other files or directories
|
||||
*/
|
||||
protected $ignoresymlinks = false;
|
||||
|
||||
/**
|
||||
* Sets the path to the phpDocumentor executable
|
||||
*/
|
||||
public function setProgramPath($programPath)
|
||||
{
|
||||
$this->programPath = $programPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the path to the phpDocumentor executable
|
||||
*/
|
||||
public function getProgramPath()
|
||||
{
|
||||
return $this->programPath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the source path. A directory or a comma separate list of directories.
|
||||
*/
|
||||
public function setSourcepath($sourcepath)
|
||||
{
|
||||
$this->sourcepath = $sourcepath;
|
||||
}
|
||||
|
||||
/**
|
||||
* Ignore symlinks to other files or directories.
|
||||
*
|
||||
* @param bool $bSet
|
||||
*/
|
||||
public function setIgnoresymlinks($bSet) {
|
||||
$this->ignoresymlinks = $bSet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entrypoint of the task
|
||||
*/
|
||||
public function main()
|
||||
{
|
||||
$this->validate();
|
||||
$arguments = join(' ', $this->constructArguments());
|
||||
|
||||
$this->log("Running phpDocumentor...");
|
||||
|
||||
exec($this->programPath . " " . $arguments, $output, $return);
|
||||
|
||||
if ($return != 0)
|
||||
{
|
||||
throw new BuildException("Could not execute phpDocumentor: " . implode(' ', $output));
|
||||
}
|
||||
|
||||
foreach($output as $line)
|
||||
{
|
||||
if(strpos($line, 'ERROR') !== false)
|
||||
{
|
||||
$this->log($line, Project::MSG_ERR);
|
||||
continue;
|
||||
}
|
||||
|
||||
$this->log($line, Project::MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an argument string for phpDocumentor
|
||||
* @return array
|
||||
*/
|
||||
protected function constructArguments()
|
||||
{
|
||||
$aArgs = array();
|
||||
if ($this->title)
|
||||
{
|
||||
$aArgs[] = '--title "' . $this->title . '"';
|
||||
}
|
||||
|
||||
if ($this->destdir)
|
||||
{
|
||||
$aArgs[] = '--target "' . $this->destdir->getAbsolutePath() . '"';
|
||||
}
|
||||
|
||||
if ($this->sourcepath)
|
||||
{
|
||||
$aArgs[] = '--directory "' . $this->sourcepath . '"';
|
||||
}
|
||||
|
||||
if ($this->output)
|
||||
{
|
||||
$aArgs[] = '--output ' . $this->output;
|
||||
}
|
||||
|
||||
if ($this->linksource)
|
||||
{
|
||||
$aArgs[] = '--sourcecode on';
|
||||
}
|
||||
|
||||
if ($this->parseprivate)
|
||||
{
|
||||
$aArgs[] = '--parseprivate on';
|
||||
}
|
||||
|
||||
if ($this->ignore)
|
||||
{
|
||||
$aArgs[] = '--ignore ' . $this->ignore;
|
||||
}
|
||||
|
||||
// append any files in filesets
|
||||
$filesToParse = array();
|
||||
foreach($this->filesets as $fs) {
|
||||
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
|
||||
foreach($files as $filename) {
|
||||
$f = new PhingFile($fs->getDir($this->project), $filename);
|
||||
$filesToParse[] = $f->getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (count($filesToParse) > 0) {
|
||||
$aArgs[] = '--filename "' . join(',', $filesToParse) . '"';
|
||||
}
|
||||
|
||||
// append any files in filesets
|
||||
$ricFiles = array();
|
||||
foreach($this->projDocFilesets as $fs) {
|
||||
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
|
||||
foreach($files as $filename) {
|
||||
$f = new PhingFile($fs->getDir($this->project), $filename);
|
||||
$ricFiles[] = $f->getAbsolutePath();
|
||||
}
|
||||
}
|
||||
if (count($ricFiles) > 0) {
|
||||
$aArgs[] = '--readmeinstallchangelog "' .
|
||||
join(',', $ricFiles) . '"';
|
||||
}
|
||||
|
||||
if ($this->javadocDesc) {
|
||||
$aArgs[] = '--javadocdesc on';
|
||||
}
|
||||
|
||||
if ($this->quiet) {
|
||||
$aArgs[] = '--quiet on';
|
||||
}
|
||||
|
||||
if ($this->packages) {
|
||||
$aArgs[] = '--packageoutput "' . $this->packages . '"';
|
||||
}
|
||||
|
||||
if ($this->ignoreTags) {
|
||||
$aArgs[] = '--ignore-tags "' . $this->ignoreTags . '"';
|
||||
}
|
||||
|
||||
if ($this->defaultCategoryName) {
|
||||
$aArgs[] = '--defaultcategoryname "' . $this->defaultCategoryName .
|
||||
'"';
|
||||
}
|
||||
|
||||
if ($this->examplesDir) {
|
||||
$aArgs[] = '--examplesdir "' . $this->examplesDir->getAbsolutePath()
|
||||
. '"';
|
||||
}
|
||||
|
||||
if ($this->templateBase) {
|
||||
$aArgs[] = '--templatebase "' . $this->templateBase->getAbsolutePath()
|
||||
. '"';
|
||||
}
|
||||
|
||||
if ($this->pear) {
|
||||
$aArgs[] = '--pear on';
|
||||
}
|
||||
|
||||
if ($this->undocumentedelements) {
|
||||
$aArgs[] = '--undocumentedelements on';
|
||||
}
|
||||
|
||||
if ($this->customtags) {
|
||||
$aArgs[] = '--customtags "' . $this->customtags . '"';
|
||||
}
|
||||
|
||||
if ($this->ignoresymlinks) {
|
||||
$aArgs[] = '--ignoresymlinks on';
|
||||
}
|
||||
|
||||
return $aArgs;
|
||||
}
|
||||
|
||||
/**
|
||||
* Override PhpDocumentorTask::init() because they're specific to the phpdoc
|
||||
* API which we don't use.
|
||||
*/
|
||||
public function init() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that necessary minimum options have been set. Based on
|
||||
* PhpDocumentorTask::validate().
|
||||
*/
|
||||
protected function validate() {
|
||||
if (!$this->destdir) {
|
||||
throw new BuildException("You must specify a destdir for phpdoc.",
|
||||
$this->getLocation());
|
||||
}
|
||||
if (!$this->output) {
|
||||
throw new BuildException("You must specify an output format for " .
|
||||
"phpdoc (e.g. HTML:frames:default).", $this->getLocation());
|
||||
}
|
||||
if (empty($this->filesets) && !$this->sourcepath) {
|
||||
throw new BuildException("You have not specified any files to " .
|
||||
"include (<fileset> or sourcepath attribute) for phpdoc.",
|
||||
$this->getLocation());
|
||||
}
|
||||
if ($this->configdir) {
|
||||
$this->log('Ignoring unsupported configdir-Attribute',
|
||||
Project::MSG_VERBOSE);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
485
airtime_mvc/library/phing/tasks/ext/phpdoc/PhpDocumentorTask.php
Normal file
485
airtime_mvc/library/phing/tasks/ext/phpdoc/PhpDocumentorTask.php
Normal file
|
@ -0,0 +1,485 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* $Id: PhpDocumentorTask.php 905 2010-10-05 16:28:03Z mrook $
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* This software consists of voluntary contributions made by many individuals
|
||||
* and is licensed under the LGPL. For more information please see
|
||||
* <http://phing.info>.
|
||||
*/
|
||||
|
||||
require_once 'phing/Task.php';
|
||||
|
||||
/**
|
||||
* Task to run PhpDocumentor.
|
||||
*
|
||||
* @author Hans Lellelid <hans@xmpl.org>
|
||||
* @author Michiel Rook <michiel.rook@gmail.com>
|
||||
* @version $Id: PhpDocumentorTask.php 905 2010-10-05 16:28:03Z mrook $
|
||||
* @package phing.tasks.ext.phpdoc
|
||||
*/
|
||||
class PhpDocumentorTask extends Task
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string Title for browser window / package index.
|
||||
*/
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* @var PhingFile The target directory for output files.
|
||||
*/
|
||||
protected $destdir;
|
||||
|
||||
/**
|
||||
* @var array FileSet[] Filesets for files to parse.
|
||||
*/
|
||||
protected $filesets = array();
|
||||
|
||||
/**
|
||||
* @var array FileSet[] Project documentation (README/INSTALL/CHANGELOG) files.
|
||||
*/
|
||||
protected $projDocFilesets = array();
|
||||
|
||||
/**
|
||||
* @var string Package output format.
|
||||
*/
|
||||
protected $output;
|
||||
|
||||
/**
|
||||
* @var boolean Whether to generate sourcecode for each file parsed.
|
||||
*/
|
||||
protected $linksource = false;
|
||||
|
||||
/**
|
||||
* @var boolean Whether to parse private members.
|
||||
*/
|
||||
protected $parsePrivate = false;
|
||||
|
||||
/**
|
||||
* @var boolean Whether to use javadoc descriptions (more primitive).
|
||||
*/
|
||||
protected $javadocDesc = false;
|
||||
|
||||
/**
|
||||
* @var PhingFile Base directory for locating template files.
|
||||
*/
|
||||
protected $templateBase;
|
||||
|
||||
/**
|
||||
* @var boolean Wheter to suppress output.
|
||||
*/
|
||||
protected $quiet = false;
|
||||
|
||||
/**
|
||||
* @var string Comma-separated list of packages to output.
|
||||
*/
|
||||
protected $packages;
|
||||
|
||||
/**
|
||||
* @var string Comma-separated list of tags to ignore.
|
||||
*/
|
||||
protected $ignoreTags;
|
||||
|
||||
/**
|
||||
* @var string Default package name.
|
||||
*/
|
||||
protected $defaultPackageName;
|
||||
|
||||
/**
|
||||
* @var string Default category name.
|
||||
*/
|
||||
protected $defaultCategoryName;
|
||||
|
||||
/**
|
||||
* @var PhingFile Directory in which to look for examples.
|
||||
*/
|
||||
protected $examplesDir;
|
||||
|
||||
/**
|
||||
* @var PhingFile Directory in which to look for configuration files.
|
||||
*/
|
||||
protected $configDir;
|
||||
|
||||
/**
|
||||
* @var boolean Whether to parse as a PEAR repository.
|
||||
*/
|
||||
protected $pear = false;
|
||||
|
||||
/**
|
||||
* @var boolean Control whether or not warnings will be shown for
|
||||
* undocumented elements. Useful for identifying classes and
|
||||
* methods that haven't yet been documented.
|
||||
*/
|
||||
protected $undocumentedelements = false;
|
||||
|
||||
/**
|
||||
* @var string custom tags, will be recognized and put in tags[] instead of
|
||||
* unknowntags[].
|
||||
*/
|
||||
protected $customtags = '';
|
||||
|
||||
/**
|
||||
* @var string files to ignore
|
||||
*/
|
||||
protected $ignore = '';
|
||||
|
||||
/**
|
||||
* Set the title for the generated documentation
|
||||
*/
|
||||
public function setTitle($title) {
|
||||
$this->title = $title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the destination directory for the generated documentation
|
||||
*/
|
||||
public function setDestdir(PhingFile $destdir) {
|
||||
$this->destdir = $destdir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for {@link setDestdir()).
|
||||
* @see setDestdir()
|
||||
*/
|
||||
public function setTarget(PhingFile $destdir) {
|
||||
$this->setDestdir($destdir);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the output format (e.g. HTML:Smarty:PHP).
|
||||
* @param string $output
|
||||
*/
|
||||
public function setOutput($output) {
|
||||
$this->output = $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to generate sourcecode for each file parsed
|
||||
* @param boolean
|
||||
*/
|
||||
public function setSourcecode($b) {
|
||||
$this->setLinksource($b);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to generate sourcecode for each file parsed
|
||||
* @param boolean
|
||||
*/
|
||||
public function setLinksource($b) {
|
||||
$this->linksource = $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to suppress output.
|
||||
* @param boolean $b
|
||||
*/
|
||||
public function setQuiet($b) {
|
||||
$this->quiet = $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Should private members/classes be documented
|
||||
* @param boolean
|
||||
*/
|
||||
public function setParseprivate($parseprivate) {
|
||||
$this->parsePrivate = $parseprivate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether to use javadoc descriptions (more primitive).
|
||||
* @param boolean
|
||||
*/
|
||||
public function setJavadocdesc($javadoc) {
|
||||
$this->javadocDesc = $javadoc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (comma-separated) list of packages to output.
|
||||
*
|
||||
* @param string $packages
|
||||
*/
|
||||
public function setPackageoutput($packages) {
|
||||
$this->packages = $packages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set (comma-separated) list of tags to ignore.
|
||||
*
|
||||
* @param string $tags
|
||||
*/
|
||||
public function setIgnoretags($tags) {
|
||||
$this->ignoreTags = $tags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a directory to search for examples in.
|
||||
* @param PhingFile $d
|
||||
*/
|
||||
public function setExamplesdir(PhingFile $d) {
|
||||
$this->examplesDir = $d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a directory to search for configuration files in.
|
||||
* @param PhingFile $d
|
||||
*/
|
||||
public function setConfigdir(PhingFile $d) {
|
||||
$this->configDir = $d;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default package name.
|
||||
* @param string $name
|
||||
*/
|
||||
public function setDefaultpackagename($name) {
|
||||
$this->defaultPackageName = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the default category name.
|
||||
* @param string $name
|
||||
*/
|
||||
public function setDefaultcategoryname($name) {
|
||||
$this->defaultCategoryName = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to parse as PEAR repository.
|
||||
* @param boolean $b
|
||||
*/
|
||||
public function setPear($b) {
|
||||
$this->pear = $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a FileSet.
|
||||
* @return FileSet
|
||||
*/
|
||||
public function createFileset() {
|
||||
$num = array_push($this->filesets, new FileSet());
|
||||
return $this->filesets[$num-1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a readme/install/changelog fileset.
|
||||
* @return FileSet
|
||||
*/
|
||||
public function createProjdocfileset() {
|
||||
$num = array_push($this->projDocFilesets, new FileSet());
|
||||
return $this->projDocFilesets[$num-1];
|
||||
}
|
||||
|
||||
/**
|
||||
* Control whether or not warnings will be shown for undocumented elements.
|
||||
* Useful for identifying classes and methods that haven't yet been
|
||||
* documented.
|
||||
* @param boolean $b
|
||||
*/
|
||||
public function setUndocumentedelements($b) {
|
||||
$this->undocumentedelements = $b;
|
||||
}
|
||||
|
||||
/**
|
||||
* custom tags, will be recognized and put in tags[] instead of
|
||||
* unknowntags[].
|
||||
*
|
||||
* @param string $sCustomtags
|
||||
*/
|
||||
public function setCustomtags($sCustomtags) {
|
||||
$this->customtags = $sCustomtags;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set base location of all templates for this parse.
|
||||
*
|
||||
* @param PhingFile $destdir
|
||||
*/
|
||||
public function setTemplateBase(PhingFile $oTemplateBase) {
|
||||
$this->templateBase = $oTemplateBase;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set files to ignore
|
||||
* @param string $sIgnore
|
||||
*/
|
||||
public function setIgnore($sIgnore) {
|
||||
$this->ignore = $sIgnore;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches include_path for PhpDocumentor install and adjusts include_path appropriately.
|
||||
* @throws BuildException - if unable to find PhpDocumentor on include_path
|
||||
*/
|
||||
protected function findPhpDocumentorInstall()
|
||||
{
|
||||
$found = null;
|
||||
foreach(explode(PATH_SEPARATOR, get_include_path()) as $path) {
|
||||
$testpath = $path . DIRECTORY_SEPARATOR . 'PhpDocumentor';
|
||||
if (file_exists($testpath)) {
|
||||
$found = $testpath;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!$found) {
|
||||
throw new BuildException("PhpDocumentor task depends on PhpDocumentor being installed and on include_path.", $this->getLocation());
|
||||
}
|
||||
// otherwise, adjust the include_path to path to include the PhpDocumentor directory ...
|
||||
set_include_path(get_include_path() . PATH_SEPARATOR . $found);
|
||||
include_once ("phpDocumentor/Setup.inc.php");
|
||||
if (!class_exists('phpDocumentor_setup')) {
|
||||
throw new BuildException("Error including PhpDocumentor setup class file.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load the necessary environment for running PhpDoc.
|
||||
*
|
||||
* @throws BuildException - if the phpdoc classes can't be loaded.
|
||||
*/
|
||||
public function init()
|
||||
{
|
||||
$this->findPhpDocumentorInstall();
|
||||
include_once 'phing/tasks/ext/phpdoc/PhingPhpDocumentorSetup.php';
|
||||
}
|
||||
|
||||
/**
|
||||
* Main entrypoint of the task
|
||||
*/
|
||||
function main()
|
||||
{
|
||||
$this->validate();
|
||||
$configdir = $this->configDir ? $this->configDir->getAbsolutePath() : null;
|
||||
$phpdoc = new PhingPhpDocumentorSetup($configdir);
|
||||
$this->setPhpDocumentorOptions($phpdoc);
|
||||
//$phpdoc->readCommandLineSettings();
|
||||
$phpdoc->setupConverters($this->output);
|
||||
$phpdoc->createDocs();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates that necessary minimum options have been set.
|
||||
* @throws BuildException if validation doesn't pass
|
||||
*/
|
||||
protected function validate()
|
||||
{
|
||||
if (!$this->destdir) {
|
||||
throw new BuildException("You must specify a destdir for phpdoc.", $this->getLocation());
|
||||
}
|
||||
if (!$this->output) {
|
||||
throw new BuildException("You must specify an output format for phpdoc (e.g. HTML:frames:default).", $this->getLocation());
|
||||
}
|
||||
if (empty($this->filesets)) {
|
||||
throw new BuildException("You have not specified any files to include (<fileset>) for phpdoc.", $this->getLocation());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the options on the passed-in phpdoc setup object.
|
||||
* @param PhingPhpDocumentorSetup $phpdoc
|
||||
*/
|
||||
protected function setPhpDocumentorOptions(PhingPhpDocumentorSetup $phpdoc)
|
||||
{
|
||||
|
||||
// Title MUST be set first ... (because it re-initializes the internal state of the PhpDocu renderer)
|
||||
if ($this->title) {
|
||||
$phpdoc->setTitle($this->title);
|
||||
}
|
||||
|
||||
if ($this->parsePrivate) {
|
||||
$phpdoc->setParsePrivate();
|
||||
}
|
||||
|
||||
if ($this->javadocDesc) {
|
||||
$phpdoc->setJavadocDesc();
|
||||
}
|
||||
|
||||
if ($this->quiet) {
|
||||
$phpdoc->setQuietMode();
|
||||
}
|
||||
|
||||
if ($this->destdir) {
|
||||
$phpdoc->setTargetDir($this->destdir->getAbsolutePath());
|
||||
}
|
||||
|
||||
if ($this->packages) {
|
||||
$phpdoc->setPackageOutput($this->packages);
|
||||
}
|
||||
|
||||
if ($this->templateBase) {
|
||||
$phpdoc->setTemplateBase($this->templateBase->getAbsolutePath());
|
||||
}
|
||||
|
||||
if ($this->linksource) {
|
||||
$phpdoc->setGenerateSourcecode($this->linksource);
|
||||
}
|
||||
|
||||
if ($this->examplesDir) {
|
||||
$phpdoc->setExamplesDir($this->examplesDir->getAbsolutePath());
|
||||
}
|
||||
|
||||
if ($this->ignoreTags) {
|
||||
$phpdoc->setIgnoreTags($this->ignoreTags);
|
||||
}
|
||||
|
||||
if ($this->defaultPackageName) {
|
||||
$phpdoc->setDefaultPackageName($this->defaultPackageName);
|
||||
}
|
||||
|
||||
if ($this->defaultCategoryName) {
|
||||
$phpdoc->setDefaultCategoryName($this->defaultCategoryName);
|
||||
}
|
||||
|
||||
if ($this->pear) {
|
||||
$phpdoc->setPear($this->pear);
|
||||
}
|
||||
|
||||
if ($this->ignore) {
|
||||
$phpdoc->setIgnore($this->ignore);
|
||||
}
|
||||
|
||||
// append any files in filesets
|
||||
$filesToParse = array();
|
||||
foreach($this->filesets as $fs) {
|
||||
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
|
||||
foreach($files as $filename) {
|
||||
$f = new PhingFile($fs->getDir($this->project), $filename);
|
||||
$filesToParse[] = $f->getAbsolutePath();
|
||||
}
|
||||
}
|
||||
//print_r(implode(",", $filesToParse));
|
||||
$phpdoc->setFilesToParse(implode(",", $filesToParse));
|
||||
|
||||
|
||||
// append any files in filesets
|
||||
$ricFiles = array();
|
||||
foreach($this->projDocFilesets as $fs) {
|
||||
$files = $fs->getDirectoryScanner($this->project)->getIncludedFiles();
|
||||
foreach($files as $filename) {
|
||||
$f = new PhingFile($fs->getDir($this->project), $filename);
|
||||
$ricFiles[] = $f->getName();
|
||||
}
|
||||
}
|
||||
$phpdoc->setRicFiles($ricFiles);
|
||||
|
||||
if ($this->undocumentedelements) {
|
||||
$phpdoc->setUndocumentedelements($this->undocumentedelements);
|
||||
}
|
||||
|
||||
if ($this->customtags) {
|
||||
$phpdoc->setCustomtags($this->customtags);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue