Class Summary PEAR_PackageFileManager

Class Summary PEAR_PackageFileManager – PEAR :: PackageFileManager updates the <filelist></filelist> section of a PEAR package.xml file to reflect the current files in preparation for a release.

PEAR :: PackageFileManager updates the <filelist></filelist> section of a PEAR package.xml file to reflect the current files in preparation for a release.

The PEAR_PackageFileManager class uses a plugin system to generate the list of files in a package. This allows both standard recursive directory parsing (plugin type file) and more intelligent options such as the CVS browser PEAR_PackageFileManager_Cvs, which grabs all files in a local CVS checkout to create the list, ignoring any other local files.

Other options include specifying roles for file extensions (all .php files are role="php", for example), roles for directories (all directories named "tests" are given role="tests" by default), and exceptions. Exceptions are specific pathnames with * and ? wildcards that match a default role, but should have another. For example, perhaps a debug.tpl template would normally be data, but should be included in the docs role. Along these lines, to exclude files entirely, use the ignore option.

Required options for a release include version, baseinstalldir, state, and packagedirectory (the full path to the local location of the package to create a package.xml file for)

Пример usage:

1      <?php
   2      require_once('PEAR/PackageFileManager.php');
   3      $packagexml = new
PEAR_PackageFileManager
;
   4      $e = $packagexml->
setOptions
(
   5      array('baseinstalldir' => 'PhpDocumentor',
   6       'version' => '1.2.1',
   7       'packagedirectory' => 'C:/Web Pages/chiara/phpdoc2/',
   8       'state' => 'stable',
   9       'filelistgenerator' => 'cvs', // generate from cvs, use file for directory
   10      'notes' => 'We\'ve implemented many new and exciting features',
   11      'ignore' => array('TODO', 'tests/'), // ignore TODO, all files in tests/
   12      'installexceptions' => array('phpdoc' => '/*'), // baseinstalldir ="/" for phpdoc
   13      'dir_roles' => array('tutorials' => 'doc'),
   14      'exceptions' => array('README' => 'doc', // README would be data, now is doc
   15                            'PHPLICENSE.txt' => 'doc'))); // same for the license
   16     if (PEAR::isError($e)) {
   17         echo $e->getMessage();
   18         die();
   19     }
   20     $e = $test->
addPlatformException
('pear-phpdoc.bat', 'windows');
   21     if (PEAR::isError($e)) {
   22         echo $e->getMessage();
   23         exit;
   24     }
   25     $packagexml->
addRole
('pkg', 'doc'); // add a new role mapping
   26     if (PEAR::isError($e)) {
   27         echo $e->getMessage();
   28         exit;
   29     }
   30     // replace @PHP-BIN@ in this file with the path to php executable!  pretty neat
   31     $e = $test->
addReplacement
('pear-phpdoc', 'pear-config', '@PHP-BIN@', 'php_bin');
   32     if (PEAR::isError($e)) {
   33         echo $e->getMessage();
   34         exit;
   35     }
   36     $e = $test->
addReplacement
('pear-phpdoc.bat', 'pear-config', '@PHP-BIN@', 'php_bin');
   37     if (PEAR::isError($e)) {
   38         echo $e->getMessage();
   39         exit;
   40     }
   41     // note use of
debugPackageFile()
- this is VERY important
   42     if (isset($_GET['make']) || $_SERVER['argv'][1] == 'make') {
   43         $e = $packagexml->
writePackageFile
();
   44     } else {
   45         $e = $packagexml->
debugPackageFile
();
   46     }
   47     if (PEAR::isError($e)) {
   48         echo $e->getMessage();
   49         die();
   50     }
   51     ?>

In addition, a package.xml file can now be generated from scratch, with the usage of new options package, summary, description, and the use of the addMaintainer() method

Class Trees for PEAR_PackageFileManager

  • PEAR_PackageFileManager

    Поддержать сайт на родительском проекте КГБ