Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'master' of git://github.com/phingofficial/phing

  • Loading branch information...
commit ea047e845fbf40657064300b280a69f511cb1750 2 parents 567616f + 0a3c897
@johan162 authored
View
3  classes/phing/tasks/defaults.properties
@@ -130,4 +130,5 @@ s3put=phing.tasks.ext.Service.Amazon.S3.S3PutTask
zendguardencode=phing.tasks.ext.zendguard.ZendGuardEncodeTask
zendguardlicense=phing.tasks.ext.zendguard.ZendGuardLicenseTask
docblox=phing.tasks.ext.docblox.DocBloxTask
-rST=phing.tasks.ext.rSTTask
+rST=phing.tasks.ext.rSTTask
+apigen=phing.tasks.ext.apigen.ApiGenTask
View
409 classes/phing/tasks/ext/apigen/ApiGenTask.php
@@ -0,0 +1,409 @@
+<?php
+/*
+ * 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';
+
+/**
+ * ApiGen task (http://apigen.org).
+ *
+ * @package phing.tasks.ext.apigen
+ * @author Martin Srank <martin@smasty.net>
+ * @author Jaroslav Hanslík <kukulich@kukulich.cz>
+ * @since 2.4.10
+ */
+class ApiGenTask extends Task
+{
+ /**
+ * Default ApiGen executable name.
+ *
+ * @var string
+ */
+ private $executable = 'apigen';
+
+ /**
+ * Default options for ApiGen.
+ *
+ * @var array
+ */
+ private $options = array(
+ 'progressbar' => false,
+ 'colors' => false,
+ 'update-check' => false
+ );
+
+ /**
+ * Sets the ApiGen executable name.
+ *
+ * @param string $executable
+ */
+ public function setExecutable($executable)
+ {
+ $this->executable = (string) $executable;
+ }
+
+ /**
+ * Sets the config file name.
+ *
+ * @param string $config
+ */
+ public function setConfig($config)
+ {
+ $this->options['config'] = (string) $config;
+ }
+
+ /**
+ * Sets source files or directories.
+ *
+ * @param string $source
+ */
+ public function setSource($source)
+ {
+ $this->options['source'] = explode(',', $source);
+ }
+
+ /**
+ * Sets the destination directory.
+ *
+ * @param string $destination
+ */
+ public function setDestination($destination)
+ {
+ $this->options['destination'] = (string) $destination;
+ }
+
+ /**
+ * Sets masks (case sensitive) to exclude files or directories from processing.
+ *
+ * @param string $exclude
+ */
+ public function setExclude($exclude)
+ {
+ $this->options['exclude'] = explode(',', $exclude);
+ }
+
+ /**
+ * Sets masks to exclude elements from documentation generating.
+ *
+ * @param string $skipDocPath
+ */
+ public function setSkipDocPath($skipDocPath)
+ {
+ $this->options['skip-doc-path'] = explode(',', $skipDocPath);
+ }
+
+ /**
+ * Sets a name prefix to exclude elements from documentation generating.
+ *
+ * @param string $skipDocPrefix
+ */
+ public function setSkipDocPrefix($skipDocPrefix)
+ {
+ $this->options['skip-doc-prefix'] = explode(',', $skipDocPrefix);
+ }
+
+ /**
+ * Sets the character set of source files.
+ *
+ * @param string $charset
+ */
+ public function setCharset($charset)
+ {
+ $this->options['charset'] = explode(',', $charset);
+ }
+
+ /**
+ * Sets the main project name prefix.
+ *
+ * @param string $main
+ */
+ public function setMain($main)
+ {
+ $this->options['main'] = (string) $main;
+ }
+
+ /**
+ * Sets the title of generated documentation.
+ *
+ * @param string $title
+ */
+ public function setTitle($title)
+ {
+ $this->options['title'] = (string) $title;
+ }
+
+ /**
+ * Sets the documentation base URL.
+ *
+ * @param string $baseUrl
+ */
+ public function setBaseUrl($baseUrl)
+ {
+ $this->options['base-url'] = (string) $baseUrl;
+ }
+
+ /**
+ * Sets the Google Custom Search ID.
+ *
+ * @param string $googleCseId
+ */
+ public function setGoogleCseId($googleCseId)
+ {
+ $this->options['google-cse-id'] = (string) $googleCseId;
+ }
+
+ /**
+ * Sets the Google Custom Search label.
+ *
+ * @param string $googleCseLabel
+ */
+ public function setGoogleCseLabel($googleCseLabel)
+ {
+ $this->options['google-cse-label'] = (string) $googleCseLabel;
+ }
+
+ /**
+ * Sets the Google Analytics tracking code.
+ *
+ * @param string $googleAnalytics
+ */
+ public function setGoogleAnalytics($googleAnalytics)
+ {
+ $this->options['google-analytics'] = (string) $googleAnalytics;
+ }
+
+ /**
+ * Sets the template config file name.
+ *
+ * @param string $templateConfig
+ */
+ public function setTemplateConfig($templateConfig)
+ {
+ $this->options['template-config'] = (string) $templateConfig;
+ }
+
+ /**
+ * Sets a list of HTML tags allowed in the documentation.
+ *
+ * @param string $allowedHtml
+ */
+ public function setAllowedHtml($allowedHtml)
+ {
+ $this->options['allowed-html'] = (string) $allowedHtml;
+ }
+
+ /**
+ * Sets the element access levels.
+ *
+ * Documentation only for methods and properties with the given access level will be generated.
+ *
+ * @param string $accessLevels
+ */
+ public function setAccessLevels($accessLevels)
+ {
+ $this->options['access-levels'] = (string) $accessLevels;
+ }
+
+ /**
+ * Sets if documentation for elements marked as internal and internal documentation parts should be generated.
+ *
+ * @param boolean $internal
+ */
+ public function setInternal($internal)
+ {
+ $this->options['internal'] = (bool) $internal;
+ }
+
+ /**
+ * Sets if documentation for PHP internal classes should be generated.
+ *
+ * @param boolean $php
+ */
+ public function setPhp($php)
+ {
+ $this->options['php'] = (bool) $php;
+ }
+
+ /**
+ * Sets if tree view of classes, interfaces, traits and exceptions should be generated.
+ *
+ * @param boolean $tree
+ */
+ public function setTree($tree)
+ {
+ $this->options['tree'] = (bool) $tree;
+ }
+
+ /**
+ * Sets if documentation for deprecated elements should be generated.
+ *
+ * @param boolean $deprecated
+ */
+ public function setDeprecated($deprecated)
+ {
+ $this->options['deprecated'] = (bool) $deprecated;
+ }
+
+ /**
+ * Sets if documentation of tasks should be generated.
+ *
+ * @param boolean $todo
+ */
+ public function setTodo($todo)
+ {
+ $this->options['todo'] = (bool) $todo;
+ }
+
+ /**
+ * Sets if highlighted source code files should be generated.
+ *
+ * @param boolean $sourceCode
+ */
+ public function setSourceCode($sourceCode)
+ {
+ $this->options['source-code'] = (bool) $sourceCode;
+ }
+
+ /**
+ * Sets if a link to download documentation as a ZIP archive should be generated.
+ *
+ * @param boolean $download
+ */
+ public function setDownload($download)
+ {
+ $this->options['download'] = (bool) $download;
+ }
+
+ /**
+ * Sets a file name for checkstyle report of poorly documented elements.
+ *
+ * @param string $report
+ */
+ public function setReport($report)
+ {
+ $this->options['report'] = (string) $report;
+ }
+
+ /**
+ * Sets if the destination directory should be wiped out first.
+ *
+ * @param boolean $wipeout
+ */
+ public function setWipeout($wipeout)
+ {
+ $this->options['wipeout'] = (bool) $wipeout;
+ }
+
+ /**
+ * Enables/disables scaning and generating messages.
+ *
+ * @param boolean $quiet
+ */
+ public function setQuiet($quiet)
+ {
+ $this->options['quiet'] = (bool) $quiet;
+ }
+
+ /**
+ * Enables/disables the check for ApiGen updates.
+ *
+ * @param boolean $updateCheck
+ */
+ public function setUpdateCheck($updateCheck)
+ {
+ $this->options['update-check'] = (bool) $updateCheck;
+ }
+
+ /**
+ * Enables/disables the debug mode.
+ *
+ * @param boolean $debug
+ */
+ public function setDebug($debug)
+ {
+ $this->options['debug'] = (bool) $debug;
+ }
+
+ /**
+ * Runs ApiGen.
+ *
+ * @throws BuildException If something is wrong.
+ * @see Task::main()
+ */
+ public function main()
+ {
+ if ('apigen' !== $this->executable && !is_file($this->executable)) {
+ throw new BuildException(sprintf('Executable %s not found', $this->executable), $this->getLocation());
+ }
+
+ if (!empty($this->options['config'])) {
+ // Config check
+ if (!is_file($this->options['config'])) {
+ throw new BuildException(sprintf('Config file %s doesn\'t exist', $this->options['config']), $this->getLocation());
+ }
+ } else {
+ // Source check
+ if (empty($this->options['source'])) {
+ throw new BuildException('Source is not set', $this->getLocation());
+ }
+ // Destination check
+ if (empty($this->options['destination'])) {
+ throw new BuildException('Destination is not set', $this->getLocation());
+ }
+ }
+
+ // Source check
+ if (!empty($this->options['source'])) {
+ foreach ($this->options['source'] as $source) {
+ if (!file_exists($source)) {
+ throw new BuildException(sprintf('Source %s doesn\'t exist', $source), $this->getLocation());
+ }
+ }
+ }
+
+ // Execute ApiGen
+ exec(escapeshellcmd($this->executable) . ' ' . $this->constructArguments(), $output, $return);
+
+ $logType = 0 === $return ? Project::MSG_VERBOSE : Project::MSG_ERR;
+ foreach ($output as $line) {
+ $this->log($line, $logType);
+ }
+ }
+
+ /**
+ * Generates command line arguments for the ApiGen executable.
+ *
+ * @return string
+ */
+ protected function constructArguments()
+ {
+ $args = array();
+ foreach ($this->options as $option => $value) {
+ if (is_bool($value)) {
+ $args[] = '--' . $option . '=' . ($value ? 'yes' : 'no');
+ } elseif (is_array($value)) {
+ foreach ($value as $v) {
+ $args[] = '--' . $option . '=' . escapeshellarg($v);
+ }
+ } else {
+ $args[] = '--' . $option . '=' . escapeshellarg($value);
+ }
+ }
+ return implode(' ', $args);
+ }
+}
View
179 classes/phing/tasks/ext/git/GitCommitTask.php
@@ -0,0 +1,179 @@
+<?php
+/*
+ * $Id$
+ *
+ * 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';
+require_once 'phing/tasks/ext/git/GitBaseTask.php';
+/**
+ * Wrapper around git-commit
+ *
+ * @package Phing.tasks.ext.git
+ * @author Jonathan Creasy <jonathan.creasy@gmail.com>
+ * @see VersionControl_Git
+ * @since 2.4.3
+ */
+class GitCommitTask extends GitBaseTask
+{
+ /**
+ * Path to target directory
+ * @var string
+ */
+ private $targetPath;
+
+ private $allFiles;
+
+ private $message;
+
+ private $files;
+
+ /**
+ * The main entry point for the task
+ */
+ public function main()
+ {
+ if (null === $this->getRepository()) {
+ throw new BuildException('"repository" is required parameter');
+ }
+
+ if (null === $this->getTargetPath()) {
+ throw new BuildException('"targetPath" is required parameter');
+ }
+
+ if ($this->allFiles !== true && empty($this->files))
+ {
+ throw new BuildException('"allFiles" cannot be false if no files are specified.');
+ }
+
+ $client = $this->getGitClient(false, $this->getTargetPath());
+
+ $options = Array();
+
+ if ($this->allFiles === true)
+ {
+ $options['all'] = true;
+ }
+
+ $arguments = Array();
+ if ($this->allFiles !== true && is_array($this->files))
+ {
+ foreach($files as $file)
+ {
+ $arguments[] = $file;
+ }
+ }
+
+ if (!empty($this->message))
+ {
+ $arguments[] = $this->message;
+ } else {
+ $options['allow-empty-message'] = true;
+ }
+
+ try {
+ $command = $git->Command('commit');
+ $command->setArguments($arguments);
+ $command->setOptions($options);
+ $command->execute();
+ } catch (Exception $e) {
+ throw new BuildException('The remote end hung up unexpectedly');
+ }
+
+ $msg = 'git-commit: Executed git commit ';
+ foreach ($options as $option=>$value)
+ {
+
+ $msg .= ' --' . $options . '=' . $value;
+ }
+
+ foreach ($arguments as $argument)
+ {
+ $msg .= ' ' . $argument;
+ }
+
+ $this->log($msg, Project::MSG_INFO);
+ }
+
+ /**
+ * Get path to target direcotry repo
+ *
+ * @return string
+ */
+ public function getTargetPath()
+ {
+ return $this->targetPath;
+ }
+
+ /**
+ * Set path to source repo
+ *
+ * @param string $targetPath Path to repository used as source
+ * @return void
+ */
+ public function setTargetPath($targetPath)
+ {
+ $this->targetPath = $targetPath;
+ }
+
+ /**
+ * Alias @see getAllFiles()
+ *
+ * @return string
+ */
+ public function isallFiles()
+ {
+ return $this->getallFiles();
+ }
+
+ public function getallFiles()
+ {
+ return $this->allFiles;
+ }
+
+ public function setallFiles($flag)
+ {
+ $this->allFiles = (bool)$flag;
+ }
+
+ public function getMessage()
+ {
+ return $this->message;
+ }
+
+ public function setMessage($message)
+ {
+ $this->message = $message;
+ }
+
+ public function getFiles()
+ {
+ return $this->files;
+ }
+
+ public function setFiles($files)
+ {
+ if (!$empty($files) && is_array($files))
+ {
+ $this->setallfiles(false);
+ $this->Files = $files;
+ } else {
+ $this->Files = null;
+ }
+ }
+}
View
239 docs/phing_guide/book/chapters/appendixes/AppendixC-OptionalTasks.html
@@ -23,6 +23,245 @@
<p> This reference lists the tasks alphabetically by the name of the classes that implement
the tasks. So if you are searching for the reference to the <code>&lt;phplint&gt;</code>
tag, for example, you will want to look at the reference of PhpLintTask. </p>
+
+ <h2>
+ <a name="ApiGenTask"></a>ApiGenTask
+ </h2>
+ <p>
+ This task runs <a href="http://apigen.org/" target="_blank">ApiGen</a>,
+ a tool for creating professional API documentation from PHP source code,
+ similar to discontinued phpDocumentor/phpDoc.
+ </p>
+ <h3>Attributes</h3>
+ <table>
+ <thead>
+ <tr>
+ <th>Name</th>
+ <th>Type</th>
+ <th>Description</th>
+ <th>Default</th>
+ <th>Required</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>executable</td>
+ <td>String</td>
+ <td>ApiGen executable name.</td>
+ <td>apigen</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>config</td>
+ <td>String</td>
+ <td>Config file name.</td>
+ <td>n/a</td>
+ <td rowspan="2">Source and destination are required - either set explicitly
+ or using a config file. Attribute values set explicitly have precedence
+ over values from a config file.</td>
+ </tr>
+ <tr>
+ <td>source</td>
+ <td>String</td>
+ <td>List of source files or directories.</td>
+ <td>n/a</td>
+ </tr>
+ <tr>
+ <td>destination</td>
+ <td>String</td>
+ <td>Destination directory.</td>
+ <td>n/a</td>
+ </tr>
+ <tr>
+ <td>exclude</td>
+ <td>String</td>
+ <td>List of masks (case sensitive) to exclude files or directories from processing.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>skipdocpath</td>
+ <td>String</td>
+ <td>List of masks (case sensitive) to exclude elements from documentation generating.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>skipdocprefix</td>
+ <td>String</td>
+ <td>Name prefix (case sensitive) to exclude elements from documentation generating.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>charset</td>
+ <td>String</td>
+ <td>Character set of source files.</td>
+ <td>UTF-8</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>main</td>
+ <td>String</td>
+ <td>Main project name prefix.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>title</td>
+ <td>String</td>
+ <td>Title of generated documentation.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>baseurl</td>
+ <td>String</td>
+ <td>Documentation base URL.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>googlecseid</td>
+ <td>String</td>
+ <td>Google Custom Search ID.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>googlecselabel</td>
+ <td>String</td>
+ <td>Google Custom Search label.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>googleanalytics</td>
+ <td>String</td>
+ <td>Google Analytics tracking code.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>templateconfig</td>
+ <td>String</td>
+ <td>Template config file name.</td>
+ <td>n/a</td>
+ <td>If not set the default template is used.</td>
+ </tr>
+ <tr>
+ <td>allowedhtml</td>
+ <td>String</td>
+ <td>List of HTML tags allowed in the documentation.</td>
+ <td>b,i,a,ul,ol,li,p,br,var,samp,kbd,tt</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>accesslevels</td>
+ <td>String</td>
+ <td>Element access levels. Documentation only for methods and properties
+ with the given access level will be generated.</td>
+ <td>public,protected</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>internal</td>
+ <td>Boolean</td>
+ <td>Whether to generate documentation for elements marked as internal
+ and internal documentation parts or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>php</td>
+ <td>Boolean</td>
+ <td>Whether to generate documentation for PHP internal classes or not.</td>
+ <td>Yes</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>tree</td>
+ <td>Boolean</td>
+ <td>Whether to generate tree view of classes, interfaces, traits
+ and exceptions or not.</td>
+ <td>Yes</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>deprecated</td>
+ <td>Boolean</td>
+ <td>Whether to generate documentation for deprecated elements or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>todo</td>
+ <td>Boolean</td>
+ <td>Whether to generate documentation of tasks or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>sourcecode</td>
+ <td>Boolean</td>
+ <td>Whether to generate highlighted source code files or not.</td>
+ <td>Yes</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>download</td>
+ <td>Boolean</td>
+ <td>Whether to generate a link to download documentation as a ZIP archive or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>report</td>
+ <td>String</td>
+ <td>File name for checkstyle report of poorly documented elements.</td>
+ <td>n/a</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>wipeout</td>
+ <td>Boolean</td>
+ <td>Whether to wipe out the destination directory first or not.</td>
+ <td>Yes</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>quiet</td>
+ <td>Boolean</td>
+ <td>Whether to enable scaning and generating messages or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>updatecheck</td>
+ <td>Boolean</td>
+ <td>Whether to check for ApiGen updates or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ <tr>
+ <td>debug</td>
+ <td>Boolean</td>
+ <td>Whether to enable the debug mode or not.</td>
+ <td>No</td>
+ <td>No</td>
+ </tr>
+ </tbody>
+ </table>
+ <h3>Examples</h3>
+ <pre>
+&lt;apigen
+&nbsp;&nbsp;source=&quot;classes&quot;
+&nbsp;&nbsp;destination=&quot;api&quot;
+&nbsp;&nbsp;exclude=&quot;*/tests/*&quot;
+&nbsp;&nbsp;title=&quot;My Project API Documentation&quot;
+&nbsp;&nbsp;deprecated=&quot;true&quot;
+&nbsp;&nbsp;todo="true"/&gt;
+</pre>
<h2>
<a name="CoverageMergerTask"></a>CoverageMergerTask </h2>
<p>The CoverageMergerTask merges code coverage information from external sources with an
Please sign in to comment.
Something went wrong with that request. Please try again.