phing-tasks-ext

# Class: PearPackageTask Source Location: /tasks/ext/PearPackageTask.php
### Class Overview
    ProjectComponent
       |
       --Task
          |
          --MatchingTask
             |
             --PearPackageTask
A task to create PEAR package.xml file. #### Author(s): Hans Lellelid <hans@xmpl.org> #### Version: $Id: PearPackageTask.php 557 2009-08-29 13:54:38Z mrook $ #### Copyright: � 2001,2002 THYRELL. All rights reserved | ### Variables $dir $mappings $options $package $pkg | ### Methods createFileSet createMapping createOption getFileSets init main setDestFile setDir setName setOptions setPackage
### Child classes: PearPackage2Task A task to create a PEAR package.xml version 2.0 file. | ### Inherited Variables #### Class: MatchingTask MatchingTask::$fileset MatchingTask::$useDefaultExcludes #### Class: Task Task::$description Task::$location Task::$target Task::$taskName Task::$taskType Task::$wrapper #### Class: ProjectComponent ProjectComponent::$project | ### Inherited Methods #### Class: MatchingTask MatchingTask::__construct() Create instance; set fileset to new FileSet. MatchingTask::appendSelector() Add a new selector into this container. MatchingTask::createAnd() add an "And" selector entry on the selector list MatchingTask::createContains() add a contains selector entry on the selector list MatchingTask::createCustom() add an extended selector entry on the selector list MatchingTask::createDate() add a selector date entry on the selector list MatchingTask::createDepend() add a depends selector entry on the selector list MatchingTask::createDepth() add a depth selector entry on the selector list MatchingTask::createExclude() add a name entry on the exclude list MatchingTask::createExcludesFile() add a name entry on the include files list MatchingTask::createFilename() add a selector filename entry on the selector list MatchingTask::createInclude() add a name entry on the include list MatchingTask::createIncludesFile() add a name entry on the include files list MatchingTask::createMajority() add a majority selector entry on the selector list MatchingTask::createNone() add a "None" selector entry on the selector list MatchingTask::createNot() add a "Not" selector entry on the selector list MatchingTask::createOr() add an "Or" selector entry on the selector list MatchingTask::createPatternSet() add a set of patterns MatchingTask::createPresent() add a present selector entry on the selector list MatchingTask::createSelector() add a "Select" selector entry on the selector list MatchingTask::createSize() add a selector size entry on the selector list MatchingTask::getDirectoryScanner() Returns the directory scanner needed to access the files to process. MatchingTask::getImplicitFileSet() Accessor for the implict fileset. MatchingTask::getSelectors() Returns the set of selectors as an array. MatchingTask::hasSelectors() Indicates whether there are any selectors here. MatchingTask::selectorCount() Gives the count of the number of selectors in this container MatchingTask::selectorElements() Returns an enumerator for accessing the set of selectors. MatchingTask::setCaseSensitive() Sets case sensitivity of the file system MatchingTask::setDefaultexcludes() Sets whether default exclusions should be used or not. MatchingTask::setExcludes() Sets the set of exclude patterns. Patterns may be separated by a comma or a space. MatchingTask::setExcludesfile() Sets the name of the file containing the includes patterns. MatchingTask::setFollowSymlinks() Sets whether or not symbolic links should be followed. MatchingTask::setIncludes() Sets the set of include patterns. Patterns may be separated by a comma or a space. MatchingTask::setIncludesfile() Sets the name of the file containing the includes patterns. MatchingTask::setProject() #### Class: Task Task::getDescription() Returns the textual description of the task Task::getLocation() Returns the location within the buildfile this task occurs. Used by BuildException to give detailed error messages. Task::getOwningTarget() Returns the owning target of this task. Task::getRegisterSlot() Returns a name Task::getRuntimeConfigurableWrapper() Returns the wrapper object for runtime configuration Task::getTaskName() Returns the name of task, used only for log messages Task::getTaskType() Returns the name of the task under which it was invoked, usually the XML tagname Task::init() Called by the parser to let the task initialize properly. Task::log() Provides a project level log event to the task. Task::main() Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice. Task::maybeConfigure() Configure this task if it hasn't been done already. Task::perform() Perfrom this task Task::setDescription() Sets a textual description of the task Task::setLocation() Sets the location within the buildfile this task occurs. Called by the parser to set location information. Task::setOwningTarget() Sets the owning target this task belongs to. Task::setRuntimeConfigurableWrapper() Sets the wrapper object this task should use for runtime configurable elements. Task::setTaskName() Sets the name of this task for log messages Task::setTaskType() Sets the type of the task. Usually this is the name of the XML tag #### Class: ProjectComponent ProjectComponent::getProject() Returns a reference to current project ProjectComponent::log() Logs a message with the given priority. ProjectComponent::setProject() References the project to the current component.
### Class Details [line 79] A task to create PEAR package.xml file. This class uses the PEAR_PackageFileMaintainer class to perform the work. This class is designed to be very flexible -- i.e. account for changes to the package.xml w/o requiring changes to this class. We've accomplished this by having generic <option> and <mapping> nested elements. All options are set using PEAR_PackageFileMaintainer::setOptions(). The <option> tag is used to set a simple option value. <option name="option_name" value="option_value"/> or <option name="option_name">option_value</option> The <mapping> tag represents a complex data type. You can use nested <element> (and nested <element> with <element> tags) to represent the full complexity of the structure. Bear in mind that what you are creating will be mapped to an associative array that will be passed in via PEAR_PackageFileMaintainer::setOptions(). <mapping name="option_name"> <element key="key_name" value="key_val"/> <element key="key_name" value="key_val"/> </mapping> Here's an over-simple example of how this could be used: <pearpkg name="phing" dir="${build.src.dir}" destFile="${build.base.dir}/package.xml"> <fileset> <include name="**"/> </fileset> <option name="notes">Sample release notes here.</option> <option name="description">Package description</option> <option name="summary">Short description</option> <option name="version" value="2.0.0b1"/> <option name="state" value="beta"/> <mapping name="maintainers"> <element> <element key="handle" value="hlellelid"/> <element key="name" value="Hans"/> <element key="email" value="hans@xmpl.org"/> <element key="role" value="lead"/> </element> </mapping> </pearpkg> Look at the build.xml in the Phing base directory (assuming you have the full distro / CVS version of Phing) to see a more complete example of how to call this script. #### Tags:
author: | Hans Lellelid <hans@xmpl.org>
version: | $Id: PearPackageTask.php 557 2009-08-29 13:54:38Z mrook $
copyright: | � 2001,2002 THYRELL. All rights reserved
[ Top ] ### Class Variables #### $dir = [line 85] Base directory for reading files. #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $mappings = array() [line 102] Nested <mapping> (complex options) types. #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $options = array() [line 99] #### Tags:
var: | PearPkgOption[]
access: | protected
Type: | array
[ Top ] #### $package = [line 82] #### Tags:
access: | protected
Type: | mixed
[ Top ] #### $pkg = [line 94] #### Tags:
access: | protected
Type: | PEAR_PackageFileManager
[ Top ] ### Class Methods ### method createFileSet [line 249]
`FileSet createFileSet( )`
Nested creator, creates a FileSet for this task #### Tags:
return: | The created fileset object
[ Top ] ### method createMapping [line 301]
`void createMapping( )`
Handles nested generic <option> elements. [ Top ] ### method createOption [line 292]
`void createOption( )`
Handles nested generic <option> elements. [ Top ] ### method getFileSets [line 236]
`array getFileSets( )`
Used by the PEAR_PackageFileManager_PhingFileSet lister. #### Tags:
return: | FileSet[]
access: | public
[ Top ] ### method init [line 104]
`void init( )`
#### Tags:
access: | public
Overridden in child classes as: PearPackage2Task::init() Overrides Task::init() (Called by the parser to let the task initialize properly.) [ Top ] ### method main [line 211]
`void main( )`
Main entry point. #### Tags:
access: | public
Overridden in child classes as: PearPackage2Task::main() Main entry point. Overrides Task::main() (Called by the project to let the task do it's work. This method may be called more than once, if the task is invoked more than once. For example, if target1 and target2 both depend on target3, then running <em>phing target1 target2</em> will run all tasks in target3 twice.) [ Top ] ### method setDestFile [line 285]
`void setDestFile( $f)`
Sets the file to use for generated package.xml #### Tags:
access: | public
#### Parameters:
PhingFile | $f |
[ Top ] ### method setDir [line 269]
`void setDir( $f)`
Sets "dir" property from XML. #### Tags:
access: | public
#### Parameters:
PhingFile | $f |
[ Top ] ### method setName [line 278]
`void setName( string $v)`
Sets "name" property from XML. #### Tags:
access: | public
#### Parameters:
string | $v |
[ Top ] ### method setOptions [line 115]
`void setOptions( )`
Sets PEAR package.xml options, based on class properties. #### Tags:
access: | protected
[ Top ] ### method setPackage [line 260]
`void setPackage( string $v)`
Set "package" property from XML. #### Tags:
see: | PearPackageTask::setName()
access: | public
#### Parameters:
string | $v |
[ Top ] Documentation generated on Mon, 19 Oct 2009 10:51:29 +0200 by phpDocumentor 1.4.3