Pearfarm_PackageSpecPearfarm_PackageSpec is a simplified DSL for creating basic pear pacakges.
Instead of having to learn about the complexities of PEAR you can just specify a few basic facts and Pearfarm will build you a reasonable package.xml.
If you don't already have a pearfarm.spec file for your project, just run "pearfarm init" and an example spec file will be generated for you. Then you need only edit the boilerplate in the pearfarm.spec file and customize it for your needs, using these docs as a reference.
To build a PEAR package based on your pearfarm.spec, run "pear package". Pay careful attention to any errors and warnings you see; pearfarm itself doesn't do much error checking since "pear package" already does a lot.
NOTE: this code was hacked up quickly one weekend and isn't particularly pretty. I was learning PEAR architecture at the same time. My apologies in advance.
NOTE: below are the meta-method docs for stuff done via __call. Phpdoc sucks so they don't show up very well.
Located in /PackageSpec.php (line 38)
object Pearfarm_PackageSpec
addExecutable
(string $scriptFilePath, [string $renameTo = NULL], [string $platform = self::PLATFORM_ANY])
object Pearfarm_PackageSpec
addFilesRegex
(mixed $regexs, [string $role = self::ROLE_PHP], [array $options = array()])
object Pearfarm_PackageSpec
addFilesSimple
(mixed $files, [string $role = self::ROLE_PHP], [array $options = array()])
object Pearfarm_PackageSpec
addMaintainer
(string $type, string $name, string $user, string $email, [ $active = true])
object Pearfarm_PackageSpec
addPackageDependency
(string $name, string $pkgSpec, [array $options = array()])
object Pearfarm_PackageSpec
setDependsOnPearInstallerVersion
(string $min, [string $max = NULL], [string $recommended = NULL], [array $exclude = array()])
object Pearfarm_PackageSpec
setDependsOnPHPVersion
(string $min, [string $max = NULL], [array $exclude = array()])
mixed
$apiStability
= NULL (line 71)
mixed
$apiVersion
= NULL (line 70)
mixed
$channel
= NULL (line 65)
mixed
$dependsOnExtensions
= array() (line 86)
mixed
$dependsOnPearInstallerVersionExclude
= array() (line 84)
mixed
$dependsOnPearInstallerVersionMax
= NULL (line 82)
mixed
$dependsOnPearInstallerVersionMin
= '1.4.0' (line 81)
mixed
$dependsOnPearInstallerVersionRecommended
= NULL (line 83)
mixed
$dependsOnPEARPackages
= array() (line 87)
mixed
$dependsOnPHPVersionExclude
= array() (line 79)
mixed
$dependsOnPHPVersionMax
= NULL (line 78)
mixed
$dependsOnPHPVersionMin
= '5.0.0' (line 77)
mixed
$description
= NULL (line 67)
mixed
$excludeFilesRegexs
= array() (line 91)
mixed
$executables
= array() (line 92)
mixed
$files
= array() (line 90)
mixed
$license
= NULL (line 72)
mixed
$maintainers
= array() (line 74)
mixed
$name
= NULL (line 64)
mixed
$notes
= NULL (line 73)
mixed
$options
= array() (line 61)
mixed
$releaseStability
= NULL (line 69)
mixed
$releaseVersion
= NULL (line 68)
mixed
$summary
= NULL (line 66)
static create (line 744)
Fluent interface bootstrap static constructor.
Constructor __construct (line 110)
Pearfarm_PackageSpec constructor.
addExcludeFiles (line 224)
Add a file path which will cause a file that has been included previously to be excluded from the final package.
addExcludeFilesRegex (line 208)
Add a regex pattern which will cause a file that has been included previously to be excluded from the final package.
addExecutable (line 407)
Add an "exectuable" file to your package.
The file must have already been added to the package; this function just makes a previously included file be tagged as an executable in your packate so that when installed PEAR will place it in the bin/ directory.
This function is a high-level abstraction to the package.xml format for convenience reasons.
Executables added with this function get two replace-tasks added to them:
Here is example PHP code of making your executable run properly from download and PEAR installs:
Here is example shell script code of making your executable run properly from download and PEAR installs:
addFile (line 134)
Add a Pearfarm_PackageSpecFile to the list of files to add to the package.
addFilesRegex (line 170)
Add files to the PEAR package based on regex filter of file paths.
addFilesSimple (line 150)
Add a file or files to the package based on simple paths.
Paths should be relative to project root, ie: path/to/myfile.php.
addGitFiles (line 242)
Add all files that git knows about to the package.
addMaintainer (line 289)
Add a maintainer.
addPackageDependency (line 437)
Add a package dependency.
If your package depends on another pear package, this is how to manifest it.
addSvnFiles (line 260)
Add all files that svn knows about to the package.
getFile (line 193)
Get the object Pearfarm_PackageSpecFile for the given path.
setDependsOnPearInstallerVersion (line 321)
Set the PEAR installer version dependency info.
setDependsOnPHPVersion (line 303)
Set the php version dependency info.
setLicense (line 485)
Set the license for the package.
There are three forms:
writePackageFile (line 561)
Outputs the package.xml file to the location speficied in self::OPT_BASEDIR
LICENSE_APACHE
= 'APACHE'
(line 47)
LICENSE_BSD
= 'BSD'
(line 41)
LICENSE_GPL
= 'GPL'
(line 43)
LICENSE_GPL3
= 'GPL3'
(line 45)
LICENSE_LGPL
= 'LGPL'
(line 44)
LICENSE_LGPL3
= 'LGPL3'
(line 46)
LICENSE_MIT
= 'MIT'
(line 40)
LICENSE_PHP
= 'PHP'
(line 42)
OPT_BASEDIR
= 'basedir'
(line 58)
OPT_DEBUG
= 'debug'
(line 59)
PLATFORM_ANY
= 'any'
(line 55)
PLATFORM_WIN
= 'windows'
(line 56)
ROLE_DATA
= 'data'
(line 53)
ROLE_DOC
= 'doc'
(line 51)
ROLE_PHP
= 'php'
(line 49)
ROLE_SCRIPT
= 'script'
(line 50)
ROLE_TEST
= 'test'
(line 52)
Documentation generated on Tue, 12 Jan 2010 21:04:29 -0500 by phpDocumentor 1.4.3