Re: [PEAR-QA] Re: [PEAR-BUG] Doc #18347 [NEW]: No docs

[email protected] ("Patrick E.") Tue, 3 May 2011 22:50:43 +0200
Newsgroups php.pear.qa
Message-ID <[email protected]>
Hi Christian,

i created docbook Documentation for Config_Lite,
can you check and commit it?

Since i sent you the raw files, i think
all files should be in a "configuration/config-lite" folder, but
config-lite.xml in the "configuration" directory.


-- 
best Regards,
Patrick


--
Edit bug report at http://pear.php.net/bugs/bug.php?id=18347&edit=1


On Thu, Mar 10, 2011 at 9:30 PM, Matthew Fonda <[email protected]> wrote:
> On Thu, Mar 10, 2011 at 12:19 PM, Patrick E. <[email protected]> wrote:
>> Hi,
>>
>>
>> can you create a Directory "Config_Lite" under packages for me?
>> Or do i have to checkout the whole SVN pear/packages Directory to commit
>> Config_Lite to svn?
>>
>> Then i would add the "docs" (data  docs  Config  package.xml  tests)
>> directory under packages/Config_Lite/trunk, right ?
>>
>>
>>
>> --
>> best Regards,
>> Patrick C. Engel
>
> Hi Patrick,
>
> Documentation actually resides in pear/peardoc, a separate directory
> from the packages directory.
> For some more info about getting started on writing documentation, see
> http://pear.php.net/manual/en/developers.documentation.php.
>
> It looks like you have karma, so you should be able to commit the docs
> once they're ready :)
>
> Best Regards,
> --Matthew
>
config-lite.xml (text/xml, 481 B)
<?xml version="1.0" encoding="utf-8"?>
<book xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.configuration.config-lite">
 <info>
  <title>Config_Lite</title>
  <abstract>
   <para>
  <classname>Config_Lite</classname> a class for ini style configuration files.</para>
  </abstract>
 </info>

 <chapter>

 &package.configuration.config-lite.intro;
 &package.configuration.config-lite.readini;
 &package.configuration.config-lite.writeini;
 </chapter>
</book>
writeini.xml (text/xml, 2.5 KB)
<?xml version="1.0" encoding="utf-8"?>
<book xmlns="http://docbook.org/ns/docbook"
 xmlns:phd="http://www.php.net/ns/phd"
 version="lillet"
 xml:id="package.configuration.config-lite.writeini"
>
 
 <info><title>Example #2</title></info>

 <example><info><title>Writing a ini file</title></info>

 <para>
  The methods set and get keep values untouched, 
  but the save/write method normalize "bool" values to a human readable representation, 
  doublequotes strings and numeric values without any quotes.
  </para>

 <para>
  Examples  how to write a ini file.
  </para>

 <programlisting role="php"><![CDATA[
<?php

require_once 'Config/Lite.php';

$config = new Config_Lite();
$config->read('db.ini');
$config->set('db', 'user', 'JohnDoe')
	->set('db', 'password', 'd0g1tcVs$HgIn1');

// creates section 'general' with ArrayAccess
$config['general'] = array('lang' => 'fr');

echo $config;

$config->save();

?>
]]></programlisting>
 </example>
 
 <example><info><title>Creating a ini file</title></info>

<para>
  Example how to create a ini file.
</para>

<programlisting role="php"><![CDATA[
<?php

require_once 'Config/Lite.php';

$config = new Config_Lite('test.ini');
// set global properties
$config->set(null, 'debug', false)
		->set(null, 'private_key_file', '~/.ssh/id_rsa');
// and with arrayaccess
$config['public_key_file'] = '~/.ssh/id_rsa.pub';
try {
        $config->save();
} catch (Config_Lite_Exception $e) {
    echo "\n", 'Exception Message: ', $e->getMessage();
}

?>
]]></programlisting>
 </example> 
 
 
 <example><info><title>Creating a ini file with write</title></info>

<para>
Alternative file creation with write: 
</para>

<programlisting role="php"><![CDATA[
<?php

require_once 'Config/Lite.php';

$filename = 'test.ini';
$config = new Config_Lite();
try {
        $config->write($filename, array(
                        'public_key_file' =>  "~/.ssh/id_rsa.pub",
                        'general' => array(
                                'lang' => 'fr'
                        ),
                        'db' => array(
                                'user' => 'dionysis',
                                'password' => 'd0g1tcVs$HgIn1'
                        )
                )
        );
} catch (Config_Lite_Exception $exception) {
    printf("Failed to write file: %s.\n", $filename);
    printf("Exception Message: %s\n", $exception->getMessage());
    printf("Exception Stracktrace: %s\n", $exception->getTraceAsString());
}
?>
]]></programlisting>
 </example> 
 
</section>
readini.xml (text/xml, 711 B)
<?xml version="1.0" encoding="utf-8"?>
<book xmlns="http://docbook.org/ns/docbook"
 xmlns:phd="http://www.php.net/ns/phd"
 version="lillet"
 xml:id="package.configuration.config-lite.readini"
>
 
 <info><title>Example #1</title></info>
 <example><info><title>Reading from a ini file</title></info>

 <para>
  The following examples illustrates how to read a ini file.
  </para>

 <programlisting role="php"><![CDATA[
<?php

require_once 'Config/Lite.php';

/**
; db.ini
[db]
user = dionysis
password = c2oiVnY!f8sf
*/

$config = new Config_Lite('db.ini');

echo $config->get('db', 'user');

// read with ArrayAccess
echo $config['db']['password'];

echo $config;

?>
]]></programlisting>
 </example>
</section>
intro.xml (text/xml, 368 B)
<?xml version="1.0" encoding="utf-8"?>
<section xmlns="http://docbook.org/ns/docbook" version="lillet" xml:id="package.configuration.config-lite.intro">
 <info><title>Introduction to Config_Lite</title></info>
 
 <para>
   Config_Lite provides a object-oriented interface for ini style configuration files and is inspired by Pythons ConfigParser.
 </para>

</section>