Permalink
Browse files

Added a skeleton xml config file with documentation as well as a cli …

…option access it in full and in a stripped version.
  • Loading branch information...
1 parent d3533f8 commit 494c8fa1bb0edf2784424639719afdc0198f28b1 @theseer committed Jan 7, 2012
Showing with 120 additions and 1 deletion.
  1. +38 −1 src/CLI.php
  2. +82 −0 src/config/skeleton.xml
View
@@ -43,6 +43,8 @@
namespace TheSeer\phpDox {
+ use TheSeer\fDOM\fDOMDocument;
+
use TheSeer\fDOM\fDOMException;
class CLI {
@@ -81,6 +83,11 @@ public function run() {
exit(0);
}
+ if ($input->getOption('skel')->value === true) {
+ $this->showSkeletonConfig($input->getOption('strip')->value);
+ exit(0);
+ }
+
if ($input->getOption('help')->value === true) {
$this->showVersion();
$this->showUsage();
@@ -141,7 +148,7 @@ public function run() {
exit(3);
} catch (ConfigLoaderException $e) {
$this->showVersion();
- fwrite(STDERR, "\nAn error occured while trying to load the configuration file:\n" . $e->getMessage()."\n\n");
+ fwrite(STDERR, "\nAn error occured while trying to load the configuration file:\n\t" . $e->getMessage()."\n\nUsing --skel might get you started.\n\n");
exit(3);
} catch (ConfigException $e) {
fwrite(STDERR, "\nYour configuration seems to be corrupted:\n\n\t" . $e->getMessage()."\n\nPlease verify your configuration xml file.\n\n");
@@ -170,6 +177,22 @@ protected function showVersion() {
printf("phpdox %s - Copyright (C) 2010 - 2011 by Arne Blankerts\n\n", self::VERSION);
}
+ protected function showSkeletonConfig($strip) {
+ $config = file_get_contents(__DIR__ . '/config/skeleton.xml');
+ if ($strip) {
+ $dom = new fDOMDocument();
+ $dom->loadXML($config);
+ foreach($dom->query('//comment()') as $c) {
+ $c->parentNode->removeChild($c);
+ }
+ $dom->preserveWhiteSpace = false;
+ $dom->formatOutput = true;
+ $dom->loadXML($dom->saveXML());
+ $config = $dom->saveXML();
+ }
+ echo $config;
+ }
+
protected function showEngines(Array $list) {
echo "\nThe following engines are registered:\n\n";
foreach($list as $name => $desc) {
@@ -220,6 +243,17 @@ protected function registerOptions() {
'Show a list of available engines and exit'
));
+ $skel = $input->registerOption( new \ezcConsoleOption(
+ null, 'skel', \ezcConsoleInput::TYPE_NONE, null, false,
+ 'Show a skeleton config xml file and exit'
+ ));
+
+ $strip = $input->registerOption( new \ezcConsoleOption(
+ null, 'strip', \ezcConsoleInput::TYPE_NONE, null, false,
+ 'Strip xml config when showing'
+ ));
+ $strip->addDependency(new \ezcConsoleOptionRule($skel));
+
return $input;
}
@@ -239,6 +273,9 @@ protected function showUsage() {
--engines Show a list of available output engines and exit
+ --skel Show an annotated skeleton config xml file and exit
+ --strip Strip comments from skeleton config xml when showing
+
EOF;
}
@@ -0,0 +1,82 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<!-- This is a skeleton phpDox config file - Check http://phpDox.de for latest version and more info -->
+<phpdox xmlns="http://phpdox.de/config" silent="false">
+ <!-- @silent: true | false to enable or disable visual output of progress -->
+
+ <!-- Additional bootstrap files to load for additional parsers and/or engines -->
+ <!-- Place as many require nodes as you feel like in this container -->
+ <!-- syntax: <require file="/path/to/file.php" /> -->
+ <bootstrap />
+
+ <!-- A phpDox project to process, you can have multiple projects in one config file -->
+ <project name="phpdox" source="${basedir}/src" workdir="${basedir}/xml">
+ <!-- @name - The name of the project -->
+ <!-- @source - The source directory of the application to process -->
+ <!-- @workdir - The directory to store the xml data files in -->
+
+
+ <!-- A phpDox config file can define additional variables (properties) per project -->
+ <!-- <property name="some.name" value="the.value" /> -->
+ <!-- Values can make use of previously defined properties -->
+ <!-- The following are defined by default:
+
+ ${basedir} Directory of the loaded config file is in
+
+ ${phpDox.home} Directory of the phpDox installation
+ ${phpDox.file} The current config file
+ ${phpDox.version} phpDox' Version number
+
+ ${phpDox.project.name} The value of project/@name if set, otherwise 'unnamed'
+ ${phpDox.project.source} The value of project/@source if set, otherwise '${basedir}/src'
+ ${phpDox.project.workdir} The value of project/@workdir if set, otherwise '${basedir}/xml'
+
+ ${phpDox.php.version} The PHP Version of the interpreter in use
+
+ -->
+
+ <!-- Additional configuration for the collecting process (parse of php code, generation of xml data) -->
+ <collector publiconly="false">
+ <!-- @publiconly - Flag to disable/enable processing of non public methods and members -->
+
+ <!-- <include / exclude filter for filelist generator -->
+ <include mask="*.php" />
+ <exclude mask="" />
+
+ </collector>
+
+ <!-- Configuration of generation process -->
+ <generator output="${basedir}/docs">
+ <!-- @output - (Base-)Directory to store output data in -->
+
+ <!-- A generation process consists of one or more build tasks -->
+ <!-- <build engine="..." enabled="true" output="..." /> -->
+ <!-- @engine - The name of the engine this build task uses, use ./phpDox - -engines to get a list of available engines -->
+ <!-- @enabled - Flag to enable/disable this engine, default: enabled=true -->
+ <!-- @output - (optional) Output directory; if relative (no / as first char) it is interpreted as relative to generator/@output -->
+
+ <!-- An engine and thus build node can have additional configuration child nodes,
+ please check the documentation for the engine to find out more -->
+
+ <!-- default engine "html" -->
+ <build engine="html" enabled="true" output="html">
+ <template dir="${phpDox.home}/templates/html" />
+ </build>
+
+ <!--
+ <build engine="todo" enabled="true" output="todo">
+ <file name="todolist.txt" encoding="utf-8" />
+ </build>
+
+ <build engine="graph" enabled="true" output="graph">
+ <dot executable="/usr/bin/dot" render="true" format="png" />
+ </build>
+
+ <build engine="xslrunner" enabled="true" output="html2">
+ <template dir="${phpDox.home}/templates/xslrunner" />
+ </build>
+ -->
+
+ </generator>
+ </project>
+
+</phpdox>

0 comments on commit 494c8fa

Please sign in to comment.