cvs: peardoc /en/pyrus/commands package.xml /en/pyrus/differences customcommands.xml customroles.xml /en/pyrus/plugins role.xml task.xml

[email protected] ("Greg Beaver")
Newsgroups php.pear.doc
Message-ID <cvscellog1246831885@cvsserver>
cellog		Sun Jul  5 22:11:25 2009 UTC

  Modified files:              
    /peardoc/en/pyrus/commands	package.xml 
    /peardoc/en/pyrus/differences	customcommands.xml customroles.xml 
    /peardoc/en/pyrus/plugins	role.xml task.xml 
  Log:
  update pyrus docs to new namespaced API
cellog-20090705221125.txt (text/plain, 11.3 KB)
http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/commands/package.xml?r1=1.3&r2=1.4&diff_format=u
Index: peardoc/en/pyrus/commands/package.xml
diff -u peardoc/en/pyrus/commands/package.xml:1.3 peardoc/en/pyrus/commands/package.xml:1.4
--- peardoc/en/pyrus/commands/package.xml:1.3	Sat Jun 27 19:00:15 2009
+++ peardoc/en/pyrus/commands/package.xml	Sun Jul  5 22:11:25 2009
@@ -151,12 +151,13 @@
 }
 function pyrus_autoload($class)
 {
-    if (file_exists('phar://' . __FILE__ . '/php/' . implode('/', explode('_', $class)) . '.php')) {
-        include 'phar://' . __FILE__ . '/php/' . implode('/', explode('_', $class)) . '.php';
+    $class = str_replace('_', '\\', $class);
+    if (file_exists('phar://' . __FILE__ . '/php/' . implode('/', explode('\\', $class)) . '.php')) {
+        include 'phar://' . __FILE__ . '/php/' . implode('/', explode('\\', $class)) . '.php';
     }
 }
 spl_autoload_register("pyrus_autoload");
-$frontend = new PEAR2_Pyrus_ScriptFrontend_Commands;
+$frontend = new \pear2\Pyrus\ScriptFrontend\Commands;
 @array_shift($_SERVER['argv']);
 $frontend->run($_SERVER['argv']);
 __HALT_COMPILER();
http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/differences/customcommands.xml?r1=1.1&r2=1.2&diff_format=u
Index: peardoc/en/pyrus/differences/customcommands.xml
diff -u peardoc/en/pyrus/differences/customcommands.xml:1.1 peardoc/en/pyrus/differences/customcommands.xml:1.2
--- peardoc/en/pyrus/differences/customcommands.xml:1.1	Fri Jun 26 03:25:48 2009
+++ peardoc/en/pyrus/differences/customcommands.xml	Sun Jul  5 22:11:25 2009
@@ -135,7 +135,7 @@
 <commands version="2.0" xmlns="http://pear2.php.net/dtd/customcommand-2.0">
  <command>
   <name>install</name>
-  <class>PEAR2_Pyrus_ScriptFrontend_Commands</class>
+  <class>pear2\Pyrus\ScriptFrontend\Commands</class>
   <function>install</function>
   <summary>Install a package.  Use install --plugin to install plugins</summary>
   <shortcut>i</shortcut>
http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/differences/customroles.xml?r1=1.3&r2=1.4&diff_format=u
Index: peardoc/en/pyrus/differences/customroles.xml
diff -u peardoc/en/pyrus/differences/customroles.xml:1.3 peardoc/en/pyrus/differences/customroles.xml:1.4
--- peardoc/en/pyrus/differences/customroles.xml:1.3	Wed Jul  1 19:12:43 2009
+++ peardoc/en/pyrus/differences/customroles.xml	Sun Jul  5 22:11:25 2009
@@ -50,7 +50,7 @@
     <![CDATA[
 <role version="2.0" xmlns="http://pear2.php.net/dtd/customrole-2.0">
  <name>php</name>
- <class>PEAR2_Pyrus_Installer_Role_Php</class>
+ <class>pear2\Pyrus\Installer\Role\Php</class>
  <releasetypes>php</releasetypes>
  <releasetypes>extsrc</releasetypes>
  <releasetypes>extbin</releasetypes>
http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/plugins/role.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/pyrus/plugins/role.xml
diff -u peardoc/en/pyrus/plugins/role.xml:1.2 peardoc/en/pyrus/plugins/role.xml:1.3
--- peardoc/en/pyrus/plugins/role.xml:1.2	Wed Jul  1 19:12:43 2009
+++ peardoc/en/pyrus/plugins/role.xml	Sun Jul  5 22:11:25 2009
@@ -83,18 +83,18 @@
   </para>
   <programlisting role="php">
    <![CDATA[
-    function validate(PEAR2_Pyrus_IPackage $package, array $file)
+    function validate(\pear2\Pyrus\IPackage $package, array $file)
     {
-        $parser = new PEAR2_Pyrus_XMLParser;
-        $schemapath = PEAR2_Pyrus::getDataPath();
-        if (!file_exists(PEAR2_Pyrus::getDataPath() . '/customrole-2.0.xsd')) {
+        $parser = new \pear2\Pyrus\XMLParser;
+        $schemapath = \pear2\Pyrus\Main::getDataPath();
+        if (!file_exists(\pear2\Pyrus\Main::getDataPath() . '/customrole-2.0.xsd')) {
             $schemapath = realpath(__DIR__ . '/../../../../data');
         }
         $taskschema = $schemapath . '/customrole-2.0.xsd';
         try {
             $taskinfo = $parser->parse($package->getFilePath($file['attribs']['name']), $taskschema);
         } catch (\Exception $e) {
-            throw new PEAR2_Pyrus_Installer_Role_Exception('Invalid custom role definition file,' .
+            throw new \pear2\Pyrus\Installer\Role\Exception('Invalid custom role definition file,' .
                                                            ' file does not conform to the schema', $e);
         }
     }
http://cvs.php.net/viewvc.cgi/peardoc/en/pyrus/plugins/task.xml?r1=1.2&r2=1.3&diff_format=u
Index: peardoc/en/pyrus/plugins/task.xml
diff -u peardoc/en/pyrus/plugins/task.xml:1.2 peardoc/en/pyrus/plugins/task.xml:1.3
--- peardoc/en/pyrus/plugins/task.xml:1.2	Wed Jul  1 19:12:43 2009
+++ peardoc/en/pyrus/plugins/task.xml	Sun Jul  5 22:11:25 2009
@@ -42,7 +42,7 @@
  <section xml:id="pyrus.plugins.task.taskclass">
   <title>Defining the task: the task class</title>
   <para>
-   A custom file task must extend the <literal>PEAR2_Pyrus_Task_Common</literal>
+   A custom file task must extend the <literal>\pear2\Pyrus\Task\Common</literal>
    class, and must implement a few methods:
    <itemizedlist>
     <listitem><simpara><function>validateXml</function></simpara></listitem>
@@ -66,18 +66,18 @@
   <para>
    <constant>PHASE</constant> should be one of:
    <itemizedlist>
-    <listitem><simpara><constant>PEAR2_Pyrus_Task_Common::PACKAGE</constant></simpara></listitem>
-    <listitem><simpara><constant>PEAR2_Pyrus_Task_Common::INSTALL</constant></simpara></listitem>
-    <listitem><simpara><constant>PEAR2_Pyrus_Task_Common::PACKAGEANDINSTALL</constant></simpara></listitem>
-    <listitem><simpara><constant>PEAR2_Pyrus_Task_Common::POSTINSTALL</constant></simpara></listitem>
+    <listitem><simpara><constant>\pear2\Pyrus\Task\Common::PACKAGE</constant></simpara></listitem>
+    <listitem><simpara><constant>\pear2\Pyrus\Task\Common::INSTALL</constant></simpara></listitem>
+    <listitem><simpara><constant>\pear2\Pyrus\Task\Common::PACKAGEANDINSTALL</constant></simpara></listitem>
+    <listitem><simpara><constant>\pear2\Pyrus\Task\Common::POSTINSTALL</constant></simpara></listitem>
    </itemizedlist>
-   <constant>PEAR2_Pyrus_Task_Common::POSTINSTALL</constant> is only used by
+   <constant>\pear2\Pyrus\Task\Common::POSTINSTALL</constant> is only used by
    post-install scripts, the other 3 are used to determine at what time the
    task should be called.  If your custom task only works at installation-time,
-   use <constant>PEAR2_Pyrus_Task_Common::INSTALL</constant>.  If the task can
+   use <constant>\pear2\Pyrus\Task\Common::INSTALL</constant>.  If the task can
    perform only at package time (this is exceedingly rare), use
-   <constant>PEAR2_Pyrus_Task_Common::PACKAGE</constant>.  Most tasks should use
-   <constant>PEAR2_Pyrus_Task_Common::PACKAGEANDINSTALL</constant>.  If your task
+   <constant>\pear2\Pyrus\Task\Common::PACKAGE</constant>.  Most tasks should use
+   <constant>\pear2\Pyrus\Task\Common::PACKAGEANDINSTALL</constant>.  If your task
    can perform its task at packaging time, then you should override the
    <function>isPreProcessed</function> method and return true.  Some tasks, such
    as the <literal>replace</literal> task, perform some of their actions at
@@ -90,7 +90,7 @@
    task, and is passed a read/write file resource that is set to the beginning
    of the file being installed.  The full path of the file's final installation
    location is also passed in, and can be used for throwing exceptions.  All
-   errors should be handled by throwing a <literal>PEAR2_Pyrus_Task_Exception</literal>
+   errors should be handled by throwing a <literal>pear2\Pyrus\Task\Exception</literal>
    or one of its descendants.
   </para>
   <para>
@@ -109,10 +109,10 @@
   <programlisting role="php">
    <![CDATA[
 <?php
-class MyPlugin_Taskname extends PEAR2_Pyrus_Task_Common
+class MyPlugin_Taskname extends \pear2\Pyrus\Task\Common
 {
     const TYPE = 'simple';
-    const PHASE = PEAR2_Pyrus_Task_Common::PACKAGEANDINSTALL;
+    const PHASE = \pear2\Pyrus\Task\Common::PACKAGEANDINSTALL;
 
     /**
      * Initialize a task instance with the parameters
@@ -124,9 +124,9 @@
     {
         parent::__construct($pkg, $phase, $xml, $attribs, $lastversion);
         // do any special parsing of attributes/contents here
-        // phase is one of PEAR2_Pyrus_Task_Common::PACKAGE,
-        // PEAR2_Pyrus_Task_Common::INSTALL, or
-        // PEAR2_Pyrus_Task_Common::POSTINSTALL
+        // phase is one of \pear2\Pyrus\Task\Common::PACKAGE,
+        // \pear2\Pyrus\Task\Common::INSTALL, or
+        // \pear2\Pyrus\Task\Common::POSTINSTALL
     }
 
     /**
@@ -135,23 +135,23 @@
      * @param array
      * @param array the entire parsed <file> tag
      * @param string the filename of the package.xml
-     * @throws PEAR2_Pyrus_Task_Exception_InvalidTask
-     * @throws PEAR2_Pyrus_Task_Exception_NoAttributes
-     * @throws PEAR2_Pyrus_Task_Exception_MissingAttribute
-     * @throws PEAR2_Pyrus_Task_Exception_WrongAttributeValue
+     * @throws \pear2\Pyrus\Task\Exception\InvalidTask
+     * @throws \pear2\Pyrus\Task\Exception\NoAttributes
+     * @throws \pear2\Pyrus\Task\Exception\MissingAttribute
+     * @throws \pear2\Pyrus\Task\Exception\WrongAttributeValue
      */
-    static function validateXml(PEAR2_Pyrus_IPackage $pkg, $xml, $fileXml, $file)
+    static function validateXml(pear2\Pyrus\IPackage $pkg, $xml, $fileXml, $file)
     {
         if (!isset($xml['attribs'])) {
-            throw new PEAR2_Pyrus_Task_Exception_NoAttributes('taskname', $file);
+            throw new \pear2\Pyrus\Task\Exception\NoAttributes('taskname', $file);
         }
         if (!isset($xml['attribs']['attributename'])) {
-            throw new PEAR2_Pyrus_Task_Exception_MissingAttribute('taskname',
+            throw new \pear2\Pyrus\Task\Exception\MissingAttribute('taskname',
                                                                   $attrib, $file);
         }
         if ($xml['attribs']['attributename'] != 'hi'
             && $xml['attribs']['attributename'] != 'bye') {
-            throw new PEAR2_Pyrus_Task_Exception_WrongAttributeValue('taskname',
+            throw new \pear2\Pyrus\Task\Exception\WrongAttributeValue('taskname',
                                                                      'attributename',
                                                                      $xml['attribs']['attributename'],
                                                                      $file,
@@ -159,7 +159,7 @@
             }
         }
         if (MyPlugin_Other_Class::somecondition()) {
-            throw new PEAR2_Pyrus_Task_Exception_InvalidTask(
+            throw new \pear2\Pyrus\Task\Exception\InvalidTask(
                 'general validation errors should use this exception');
         }
         return true;
@@ -167,16 +167,16 @@
 
     /**
      * Perform the taskname task
-     * @param PEAR2_Pyrus_IPackage
+     * @param \pear2\Pyrus\IPackage
      * @param resource open file pointer, set to the beginning of the file
      * @param string the eventual final file location (informational only)
      * @return string|false
      */
     function startSession($fp, $dest)
     {
-        // use PEAR2_Pyrus_Log::log() to send messages to the user
-        PEAR2_Pyrus_Log::log(3, 'doing stuff');
-        PEAR2_Pyrus_Log::log(0, 'doing more important stuff');
+        // use \pear2\Pyrus\Logger::log() to send messages to the user
+        \pear2\Pyrus\Logger::log(3, 'doing stuff');
+        \pear2\Pyrus\Logger::log(0, 'doing more important stuff');
         // operate directly on the file pointer
         $contents = stream_get_contents($fp);
         $contents .= 'hi';
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.