phpDocumentor PEAR_PackageFileManager
[ class tree: PEAR_PackageFileManager ] [ index: PEAR_PackageFileManager ] [ all elements ]

Class: PEAR_PackageFileManager

Source Location: Program_Root/PackageFileManager.php

Class PEAR_PackageFileManager

Class Overview

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

The PEAR_PackageGenerate 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)

Example 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 $packagexml->addRole('pkg', 'doc'); // add a new role mapping
21 $e = $packagexml->writePackageFile();
22 if (PEAR::isError($e)) {
23 echo $e->getMessage();
24 die();
25 }
26 ?>

Located in Program_Root/PackageFileManager.php [line 141]



		
		
		
		

Methods

[ Top ]
Method Summary
PEAR_PackageFileManager   PEAR_PackageFileManager()  
void   addDependency()   Add a dependency on another package, or an extension/php
void   addRole()   Add an extension/role mapping to the role mapping option
void   debugPackageFile()   ALWAYS use this to test output before overwriting your package.xml!!
void   raiseError()   Utility function to shorten error generation code
void   setOptions()  
void   writePackageFile()   Writes the package.xml file out with the newly created <release></release> tag

[ Top ]
Methods
Constructor PEAR_PackageFileManager  [line 189]

  PEAR_PackageFileManager PEAR_PackageFileManager( )



[ Top ]
addDependency  [line 273]

  void addDependency( string $name, [string $version = false], [string $operator = 'ge'], [string $type = 'pkg']  )

Add a dependency on another package, or an extension/php

This will overwrite an existing dependency if it is found. In other words, if a dependency on PHP 4.1.0 exists, and addDependency('php', '4.3.0', 'ge', 'php') is called, the existing dependency on PHP 4.1.0 will be overwritten with the new one on PHP 4.3.0

Parameters:
string   $name:  Dependency element name
string   $version:  Dependency version
string   $operator:  A specific operator for the version, this can be one of: 'has', 'not', 'lt', 'le', 'eq', 'ne', 'ge', or 'gt'
string   $type:  Dependency type. This can be one of: 'pkg', 'ext', 'php', 'prog', 'os', 'sapi', or 'zend'


[ Top ]
addRole  [line 254]

  void addRole( string $extension, string $role  )

Add an extension/role mapping to the role mapping option

Parameters:
string   $extension:  file extension
string   $role:  role


[ Top ]
debugPackageFile  [line 364]

  void debugPackageFile( )

ALWAYS use this to test output before overwriting your package.xml!!


API Tags:
Uses:  PEAR_PackageFileManager::writePackageFile() - calls with the debug parameter set based on whether it is called from the command-line or web interface


[ Top ]
raiseError  [line 374]

  void raiseError( mixed $code, [mixed $i1 = ''], [mixed $i2 = '']  )

Utility function to shorten error generation code


API Tags:
Static:  


[ Top ]
setOptions  [line 197]

  void setOptions( [array $options = array()]  )

Parameters:
array   $options: 


[ Top ]
writePackageFile  [line 307]

  void writePackageFile( [boolean $debuginterface = null]  )

Writes the package.xml file out with the newly created <release></release> tag

Parameters:
boolean   $debuginterface:  null if no debugging, true if web interface, false if command-line

Information Tags:
Usedby:  PEAR_PackageFileManager::debugPackageFile() - calls with the debug parameter set based on whether it is called from the command-line or web interface

[ Top ]

Documentation generated on Mon, 21 Jul 2003 17:14:19 -0400 by phpDocumentor 1.2.1