* Makefile for phpxmlrpc library.
* To be used with the Pake tool: https://github.com/indeyets/pake/wiki
*
- * @copyright (c) 2015 G. Giunta
+ * @copyright (c) 2015-2020 G. Giunta
*
- * @todo allow user to specify release number and tag/branch to use
* @todo !important allow user to specify location of docbook xslt instead of the one installed via composer
*/
{
protected static $buildDir = 'build';
protected static $libVersion;
- protected static $sourceBranch = 'master';
protected static $tools = array(
- 'zip' => 'zip',
+ 'asciidoctor' => 'asciidoctor',
'fop' => 'fop',
- 'php' => 'php'
+ 'php' => 'php',
+ 'zip' => 'zip',
);
protected static $options = array(
'repo' => 'https://github.com/gggeek/phpxmlrpc',
- 'branch' => 'php53'
+ 'branch' => 'master'
);
public static function libVersion()
);
}
- /// @todo move git branch to be a named option?
public static function getOpts($args=array(), $cliOpts=array())
{
if (count($args) > 0)
// throw new \Exception('Missing library version argument');
self::$libVersion = $args[0];
- if (count($args) > 1)
- self::$sourceBranch = $args[1];
foreach (self::$tools as $name => $binary) {
if (isset($cliOpts[$name])) {
//pake_echo('---'.self::$libVersion.'---');
}
+ /**
+ * @param string $name
+ * @return string
+ */
public static function tool($name)
{
return self::$tools[$name];
}
+ /**
+ * @param string $name
+ * @return string
+ */
public static function option($name)
{
return self::$options[$name];
echo " Run 'pake -P' to list all available tasks (including hidden ones) and their dependencies\n";
echo "\n";
echo " Task options:\n";
- echo " --repo=REPO URL of the source repository to clone. defaults to the github repo.\n";
+ echo " --repo=REPO URL of the source repository to clone. Defaults to the github repo.\n";
echo " --branch=BRANCH The git branch to build from.\n";
+ echo " --asciidoctor=ASCIIDOCTOR Location of the asciidoctor command-line tool\n";
+ echo " --fop=FOP Location of the apache fop command-line tool\n";
echo " --php=PHP Location of the php command-line interpreter\n";
- echo " --fop=FOP Location of the fop command-line tool\n";
echo " --zip=ZIP Location of the zip tool\n";
}
function run_clean_doc()
{
- //pake_remove_dir(Builder::workspaceDir().'/doc/out');
pake_remove_dir(Builder::workspaceDir().'/doc/api');
$finder = pakeFinder::type('file')->name('*.html');
pake_remove($finder, Builder::workspaceDir().'/doc/manual');
+ $finder = pakeFinder::type('file')->name('*.xml');
+ pake_remove($finder, Builder::workspaceDir().'/doc/manual');
}
/**
{
$docDir = Builder::workspaceDir().'/doc';
- // API docs from phpdoc comments using phpdocumentor
+ // API docs
+
+ // from phpdoc comments using phpdocumentor
+ //$cmd = Builder::tool('php');
+ //pake_sh("$cmd vendor/phpdocumentor/phpdocumentor/bin/phpdoc run -d ".Builder::workspaceDir().'/src'." -t ".Builder::workspaceDir().'/doc/api --title PHP-XMLRPC');
+
+ // from phpdoc comments using Sami
+ $samiConfig = <<<EOT
+<?php
+ \$iterator = Symfony\Component\Finder\Finder::create()
+ ->files()
+ ->exclude('debugger')
+ ->exclude('demo')
+ ->exclude('doc')
+ ->exclude('tests')
+ ->in('./build/workspace');
+ return new Sami\Sami(\$iterator, array(
+ 'title' => 'PHP-XMLRPC',
+ 'build_dir' => 'build/workspace/doc/api',
+ 'cache_dir' => 'build/cache',
+ ));
+EOT;
+ file_put_contents('build/sami_config.php', $samiConfig);
$cmd = Builder::tool('php');
- pake_sh("$cmd vendor/phpdocumentor/phpdocumentor/bin/phpdoc run -d ".Builder::workspaceDir().'/src'." -t ".Builder::workspaceDir().'/doc/api --title PHP-XMLRPC');
+ pake_sh("$cmd vendor/sami/sami/sami.php update -vvv build/sami_config.php");
+
+ // User Manual
+
+ // html (single file) from asciidoc
+ $cmd = Builder::tool('asciidoctor');
+ pake_sh("$cmd -d book $docDir/manual/phpxmlrpc_manual.adoc");
- # Jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g.
+ // then docbook from asciidoc
+ /// @todo create phpxmlrpc_manual.xml with the good version number
+ /// @todo create phpxmlrpc_manual.xml with the date set to the one of last commit (or today?)
+ pake_sh("$cmd -d book -b docbook $docDir/manual/phpxmlrpc_manual.adoc");
+
+ # Other tools for docbook...
+ #
+ # jade cmd yet to be rebuilt, starting from xml file and putting output in ./out dir, e.g.
# jade -t xml -d custom.dsl xmlrpc_php.xml
#
# convertdoc command for xmlmind xxe editor
# -Dxslthl.config=file:///c:/htdocs/xmlrpc_cvs/docbook-xsl/highlighting/xslthl-config.xml \
# com.icl.saxon.StyleSheet -o xmlrpc_php.fo.xml xmlrpc_php.xml custom.fo.xsl use.extensions=1
- //pake_mkdirs($docDir.'/out');
-
- // HTML files from docbook
-
- Builder::applyXslt($docDir.'/manual/phpxmlrpc_manual.xml', $docDir.'/build/custom.xsl', $docDir.'/manual');
+ // HTML (multiple files) from docbook - discontinued, as we use the nicer-looking html gotten from asciidoc
+ /*Builder::applyXslt($docDir.'/manual/phpxmlrpc_manual.xml', $docDir.'/build/custom.xsl', $docDir.'/manual');
// post process html files to highlight php code samples
foreach(pakeFinder::type('file')->name('*.html')->in($docDir.'/manual') as $file)
{
file_put_contents($file, Builder::highlightPhpInHtml(file_get_contents($file)));
- }
+ }*/
// PDF file from docbook
// convert to fo and then to pdf using apache fop
Builder::applyXslt($docDir.'/manual/phpxmlrpc_manual.xml', $docDir.'/build/custom.fo.xsl', $docDir.'/manual/phpxmlrpc_manual.fo.xml');
$cmd = Builder::tool('fop');
- pake_sh("$cmd $docDir/phpxmlrpc_manual.fo.xml $docDir/phpxmlrpc_manual.pdf");
+ pake_sh("$cmd $docDir/manual/phpxmlrpc_manual.fo.xml $docDir/manual/phpxmlrpc_manual.pdf");
+
+ // cleanup
+ unlink($docDir.'/manual/phpxmlrpc_manual.xml');
unlink($docDir.'/manual/phpxmlrpc_manual.fo.xml');
}