PHP PEAR CVS 8 CVS PEAR PECL GEN CHANGELOG EXTENSION PHP PACKAGE XML PECL GEN
Date: Mon, 30 Jun 2003 11:46:44 -0000

Subject: cvs: pear /PECL_Gen ChangeLog Extension.php package.xml pecl-gen
From: hholzgra@no-spam (Hartmut Holzgraefe)

hholzgra Mon Jun 30 07:46:44 2003 EDT
Modified files: /pear/PECL_Gen Extension.php pecl-gen ChangeLog package.xml Log:
- added --help and --version options - added a short feedback howto message (can be disabled using --quiet) - --with-xml works again (ext_skel compatibility)
Index: pear/PECL_Gen/Extension.php diff -u pear/PECL_Gen/Extension.php:1.5 pear/PECL_Gen/Extension.php:1.6
--- pear/PECL_Gen/Extension.php:1.5 Mon Jun 30 06:36:57 2003
+++ pear/PECL_Gen/Extension.php Mon Jun 30 07:46:44 2003
@@no-spam -23,7 +23,7 @@no-spam * A class that generates PECL extension soure and documenation files *
* @no-spam public - * @no-spam $Id: Extension.php,v 1.5 2003/06/30 10:36:57 hholzgra Exp $
+ * @no-spam $Id: Extension.php,v 1.6 2003/06/30 11:46:44 hholzgra Exp $
*/

class PECL_Gen_Extension extends PEAR {
@@no-spam -621,7 +621,7 @@no-spam fputs($fp, PECL_Gen_Element::docbook_editor_settings());
fclose($fp);
- mkdir("$docdir/functions");
+ @no-spam"$docdir/functions");
foreach ($this->functions as $name => $function) {
$filename = $docdir . "/functions/" . strtolower(str_replace("_", "-", $name)) . ".xml";

$funcfile = fopen($filename, "w");
@@no-spam -1569,7 +1569,7 @@no-spam // }}}
function write_test_files() {
- mkdir("$this->name/tests");
+ @no-spam"$this->name/tests");
foreach ($this->functions as $function) {
$function->write_test($this);
@@no-spam -1617,14 +1617,19 @@no-spam * @no-spam private * @no-spam string directory where extension was build */
- function success_msg($dirpath)
+ function success_msg($dirpath =false)
{
- $config_option = isset($this->with['attr'] ? "--with" : "--enable";
+
+ if ($dirpath === false) {
+ $dirpath = $this->name;
+ }
+
+ $config_option = isset($this->with['attr']) ? "--with" : "--enable";
$config_option.= $this->name;
?>
To compile your new extension, you will have to execute the following steps:
-1. $ cd <?php echo $dirpath ?>
+1. $ cd <?php echo $dirpath ?> 2. $ ./phpize 3. $ ./configure [<?php echo $config_option; ?>]
4. $ make Index: pear/PECL_Gen/pecl-gen diff -u pear/PECL_Gen/pecl-gen:1.6 pear/PECL_Gen/pecl-gen:1.7
--- pear/PECL_Gen/pecl-gen:1.6 Mon Jun 30 06:36:57 2003
+++ pear/PECL_Gen/pecl-gen Mon Jun 30 07:46:44 2003
@@no-spam -5,7 +5,7 @@no-spam * Console script to generate PECL extensions from command line *
* @no-spam Hartmut Holzgraefe <hartmut@no-spam>
-* @no-spam $Id: pecl-gen,v 1.6 2003/06/30 10:36:57 hholzgra Exp $
+* @no-spam $Id: pecl-gen,v 1.7 2003/06/30 11:46:44 hholzgra Exp $
*/
// includes @@no-spam -22,19 +22,32 @@no-spam $extension = new PECL_Gen_Extension;
$argv = Console_Getopt::readPHPArgv();
-$options = Console_Getopt::getopt($argv, "h?", +$options = Console_Getopt::getopt($argv, "hq", array( "help",
"extname=", "force",
"full-xml", "no-help",
- "proto=", + "proto=",
+ "quiet", "skel=", - "stubs=", + "stubs=",
+ "version",
"xml==", ));
+if (have_option($options, "help", "h")) {
+ version();
+ usage();
+ exit(0);
+}
+
+if (have_option($options, "version")) {
+ version();
+ exit(0);
+}
+
// ext_skel compatibility?
if (have_option($options, "extname")) {
$ext = new PECL_Gen_Extension;
@@no-spam -73,19 +86,43 @@no-spam
}
- System::mkdir($extname);
+ $err = System::mkdir($extname);
+ if (PEAR::isError($err)) {
+ die($err->get_message());
+ }
$err = $ext->generate_source("./$extname");
if (PEAR::isError($err)) {
die($err->get_message());
}
+ if (have_option($options, "xml")) {
+ $manpath = "$extname/manual/". str_replace('_', '-', $extname);
+
+ $err = System::mkdir("-p $manpath");
+ if (PEAR::isError($err)) {
+ die($err->get_message());
+ }
+
+ $err = $ext->generate_documentation($manpath);
+ if (PEAR::isError($err)) {
+ die($err->get_message());
+ }
+ }
+
+ if (!have_option($options, "quiet")) {
+ $ext->success_msg($extname);
+ }
+
exit(0);
}
// normal operation: read XML file and go with that -if (count($options[1]) != 1) usage();
+if (count($options[1]) != 1) {
+ usage();
+ exit(3);
+}
$xmlfile = $options[1][0];
@@no-spam -112,10 +149,24 @@no-spam die($err->getMessage()." ".$err->getUserInfo());
}
+if (!have_option($options, "quiet")) {
+ $ext->success_msg($extname);
+}
+
exit(0);
+
+
+
+function version()
+{
+ $fp = fopen("php://stderr", "w");
+ fputs($fp, "pecl-gen 0.7.0-dev, Copyright (c) 2003 The PHP Group\n");
+ fclose($fp);
+}
+
function usage($message = false)
{
$fp = fopen("php://stderr", "w");
@@no-spam -131,30 +182,28 @@no-spam --extname=module module is the name of your extension --force overwrite existing directories --proto=file file contains prototypes of functions to create + --xml generate xml documentation to be added to phpdoc-cvs the following options are inherited from ext_skel they are accepted but currently not used in any way ...
-
+ --full-xml generate xml documentation for a self-contained extension + (we need something like 'phpdocize' for that?) --stubs=file generate only function stubs in file - --xml generate xml documentation to be added to phpdoc-cvs --skel=dir path to the skeleton directory - --full-xml generate xml documentation for a self-contained extension - (not yet implemented)
--no-help don't try to be nice and create comments in the code and helper functions to test if the module compiled ");
fclose($fp);
-
- exit(3);
}
-function have_option($options, $name)
+function have_option($options, $name, $char=false)
{
foreach ($options[0] as $opt)
{
if ($opt[0] == "--$name") return true; + if (is_string($char) && $opt[0]{0} === $char) return true;
}
return false;
Index: pear/PECL_Gen/ChangeLog diff -u pear/PECL_Gen/ChangeLog:1.1 pear/PECL_Gen/ChangeLog:1.2
--- pear/PECL_Gen/ChangeLog:1.1 Mon Jun 30 06:37:33 2003
+++ pear/PECL_Gen/ChangeLog Mon Jun 30 07:46:44 2003
@@no-spam -1,3 +1,11 @@no-spam +- added --help and --version options +
+- added a short feedback howto message + (can be disabled using --quiet) +
+- --with-xml works again + (ext_skel compatibility)
+
- will now only purge and overwrite existing target directory if '--force' is requested on cmd line Index: pear/PECL_Gen/package.xml diff -u pear/PECL_Gen/package.xml:1.4 pear/PECL_Gen/package.xml:1.5
--- pear/PECL_Gen/package.xml:1.4 Sun Jun 29 15:39:02 2003
+++ pear/PECL_Gen/package.xml Mon Jun 30 07:46:44 2003
@@no-spam -25,10 +25,10 @@no-spam <release>
<state>beta</state>
- <version>0.6.1</version>
- <date>2003-06-29</date>
+ <version>0.7.0-dev</version>
+ <date>2003-06-30</date>
<notes>
- typo fix in package.xml dependencies entry for XML_Parser + see ChangeLog for now ...
</notes>
<deps>
<dep type="php" rel="ge" version="5.0"/>
@@no-spam -68,6 +68,14 @@no-spam </release>
<changelog>
+ <release>
+ <state>beta</state>
+ <version>0.6.1</version>
+ <date>2003-06-29</date>
+ <notes>
+ typo fix in package.xml dependencies entry for XML_Parser + </notes>
+ </release>
<release>
<state>beta</state>
<version>0.6.0</version>