Changeset 116

Show
Ignore:
Timestamp:
09/12/06 09:32:50 (2 years ago)
Author:
mrook
Message:

Merge 2.2 branch up to & including r112

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/CHANGELOG

    r115 r116  
    33 
    44 
    5 Feb. ??, 2006 - Phing 2.2.0 
    6  
    7   * Removed some lingering E_STRICT errors, bugs with 5.1.x and PHP >= 5.0.5 (HL) 
     5Aut. 21, 2006 - Phing 2.2.0 
    86 
    97  * Refactored parser to support many tags as children of base <project> tag (HL) 
     
    4341    updated documentation for the CoverageSetupTask 
    4442   
     43  * Added Unzip and Untar tasks contributed by Joakim Bodin 
    4544 
     45  * [#8, #49] Fixed bugs in TarTask related to including empty directories (HL) 
     46   
     47  * [#44] Fixed bug related to copying empty dirs. (HL) 
     48   
     49  * [#32] Fixed PHPUnit2 tasks to work with PHPUnit2-3.0.0 (MR) 
     50   
     51  * [#31] Fixed bug with using PHPDocumentor 1.3.0RC6 (MR) 
     52   
     53  * [#43] Fixed top-level (no target) IfTask behavior (Matthias Pigulla) 
     54   
     55  * [#41] Removed some lingering E_STRICT errors, bugs with 5.1.x and PHP >= 5.0.5 (HL) 
     56   
     57  * [#25] Fixed 'phing' script to also run on non-bash unix /bin/sh  
     58   
     59  * Numerous documentation improvements by many members of the community (Thanks!) 
     60   
    4661Sept. 18, 2005 - Phing 2.1.1 
    4762 
  • trunk/classes/phing/tasks/defaults.properties

    r69 r116  
    1111available=phing.tasks.system.AvailableTask 
    1212chmod=phing.tasks.system.ChmodTask 
     13concat=phing.tasks.system.AppendTask 
    1314condition=phing.tasks.system.ConditionTask 
    1415copy=phing.tasks.system.CopyTask 
     
    4849capsule=phing.tasks.ext.CapsuleTask 
    4950tar=phing.tasks.ext.TarTask 
     51untar=phing.tasks.ext.UntarTask 
    5052pearpkg=phing.tasks.ext.PearPackageTask 
    5153pearpkg2=phing.tasks.ext.PearPackage2Task 
    5254mail=phing.tasks.ext.MailTask 
    5355zip=phing.tasks.ext.ZipTask 
     56unzip=phing.tasks.ext.UnzipTask 
    5457 
    5558; "ext" tasks 
  • trunk/classes/phing/tasks/ext/ExtractBaseTask.php

    r107 r116  
    3030 */ 
    3131abstract class ExtractBaseTask extends MatchingTask { 
     32    /** 
     33     * @var PhingFile $file 
     34     */ 
    3235    protected $file; 
    33     protected $destDir; 
     36    /** 
     37     * @var PhingFile $todir 
     38     */ 
     39    protected $todir; 
     40    protected $removepath; 
    3441    protected $filesets = array(); // all fileset objects assigned to this task 
    3542 
     
    5663     * @param PhingFile $baseDir 
    5764     */ 
    58     public function setDestDir(PhingFile $destDir) { 
    59         $this->destDir = $destDir; 
     65    public function setToDir(PhingFile $todir) { 
     66        $this->todir = $todir; 
     67    } 
     68     
     69    public function setRemovePath($removepath) 
     70    { 
     71        $this->removepath = $removepath; 
    6072    } 
    6173 
     
    6880        $this->validateAttributes(); 
    6981         
    70         $destinationFileSet = new FileSet(); 
    71         $destinationFileSet->setDir($this->destDir); 
    72         $destinationDirScanner = $destinationFileSet->getDirectoryScanner($this->project); 
    73         $destinationFiles = $destinationDirScanner->getIncludedFiles(); 
    74          
    7582        $filesToExtract = array(); 
    7683        if ($this->file !== null) { 
     
    7885                $filesToExtract[] = $this->file; 
    7986            } else { 
    80                 $this->log('Nothing to do: ' . $this->destDir->getAbsolutePath() . ' is up to date for ' .  $this->file->getCanonicalPath(), PROJECT_MSG_INFO); 
     87                $this->log('Nothing to do: ' . $this->todir->getAbsolutePath() . ' is up to date for ' .  $this->file->getCanonicalPath(), PROJECT_MSG_INFO); 
    8188            } 
    8289        } 
     
    97104                   $filesToExtract[] = $compressedArchiveFile; 
    98105                } else { 
    99                         $this->log('Nothing to do: ' . $this->destDir->getAbsolutePath() . ' is up to date for ' .  $compressedArchiveFile->getCanonicalPath(), PROJECT_MSG_INFO); 
     106                        $this->log('Nothing to do: ' . $this->todir->getAbsolutePath() . ' is up to date for ' .  $compressedArchiveFile->getCanonicalPath(), PROJECT_MSG_INFO); 
    100107                } 
    101108            } 
     
    109116    abstract protected function extractArchive(PhingFile $compressedArchiveFile); 
    110117     
    111     abstract protected function isDestinationUpToDate(PhingFile $compressedArchiveFile); 
     118    /** 
     119     * @param array $files array of filenames 
     120     * @param PhingFile $dir 
     121     * @return boolean 
     122     */ 
     123    protected function isDestinationUpToDate(PhingFile $compressedArchiveFile) { 
     124        if (!$compressedArchiveFile->exists()) { 
     125                throw new BuildException("Could not find file " . $compressedArchiveFile->__toString() . " to extract."); 
     126        } 
     127         
     128        $compressedArchiveContent = $this->listArchiveContent($compressedArchiveFile); 
     129        if(is_array($compressedArchiveContent)) { 
     130             
     131            $fileSystem = FileSystem::getFileSystem(); 
     132            foreach ($compressedArchiveContent as $compressArchivePathInfo) { 
     133                $compressArchiveFilename = $compressArchivePathInfo['filename']; 
     134                if(!empty($this->removepath) && strlen($compressArchiveFilename) >= strlen($this->removepath)) 
     135                { 
     136                    $compressArchiveFilename = preg_replace('/^' . $this->removepath . '/','', $compressArchiveFilename); 
     137                } 
     138                $compressArchivePath = new PhingFile($this->todir, $compressArchiveFilename); 
     139                 
     140                if(!$compressArchivePath->exists() || 
     141                    $fileSystem->compareMTimes($compressedArchiveFile->getCanonicalPath(), $compressArchivePath->getCanonicalPath()) == 1) { 
     142                    return false; 
     143                } 
     144            } 
     145             
     146        } 
     147         
     148        return true; 
     149    } 
     150     
     151    abstract protected function listArchiveContent(PhingFile $compressedArchiveFile); 
    112152     
    113153    /** 
     
    124164        } 
    125165 
    126         if ($this->destDir === null) { 
    127             throw new BuildException("Destdir must be set."); 
     166        if ($this->todir === null) { 
     167            throw new BuildException("todir must be set."); 
    128168        } 
    129169         
    130         if ($this->destDir !== null && $this->destDir->exists() && !$this->destDir->isDirectory()) { 
    131             throw new BuildException("Destdir must be a directory."); 
     170        if ($this->todir !== null && $this->todir->exists() && !$this->todir->isDirectory()) { 
     171            throw new BuildException("todir must be a directory."); 
    132172        } 
    133173 
  • trunk/classes/phing/tasks/ext/TarTask.php

    r43 r116  
    4545    private $tarFile; 
    4646    private $baseDir; 
    47  
     47        private $includeEmpty = true; // Whether to include empty dirs in the TAR 
     48         
    4849    private $longFileMode = "warn"; 
    4950 
     
    106107    public function setBasedir(PhingFile $baseDir) { 
    107108        $this->baseDir = $baseDir; 
     109    } 
     110 
     111    /** 
     112     * Set the include empty dirs flag. 
     113     * @param  boolean  Flag if empty dirs should be tarred too 
     114     * @return void 
     115     * @access public 
     116     */ 
     117    function setIncludeEmptyDirs($bool) { 
     118        $this->includeEmpty = (boolean) $bool; 
    108119    } 
    109120 
     
    178189                    throw new BuildException("basedir does not exist!", $this->getLocation()); 
    179190                } 
    180  
    181                 // add the main fileset to the list of filesets to process. 
    182                 $mainFileSet = new TarFileSet($this->fileset); 
    183                 $mainFileSet->setDir($this->baseDir); 
    184                 $this->filesets[] = $mainFileSet; 
     191                                if (empty($this->filesets)) { // if there weren't any explicit filesets specivied, then 
     192                                                                          // create a default, all-inclusive fileset using the specified basedir. 
     193                        $mainFileSet = new TarFileSet($this->fileset); 
     194                        $mainFileSet->setDir($this->baseDir); 
     195                        $this->filesets[] = $mainFileSet; 
     196                    } 
    185197            } 
    186198 
     
    191203            }                         
    192204             
    193             // check if tar is out of date with respect to each 
    194             // fileset 
    195             $upToDate = true; 
    196             foreach($this->filesets as $fs) { 
    197                 $files = $fs->getFiles($this->project); 
    198                 if (!$this->archiveIsUpToDate($files, $fs->getDir($this->project))) { 
    199                     $upToDate = false; 
    200                 } 
    201                 for ($i=0, $fcount=count($files); $i < $fcount; $i++) { 
    202                     if ($this->tarFile->equals(new PhingFile($fs->getDir($this->project), $files[$i]))) { 
    203                         throw new BuildException("A tar file cannot include itself", $this->getLocation()); 
    204                     } 
    205                 } 
    206             } 
    207              
    208             if ($upToDate) { 
    209                 $this->log("Nothing to do: " . $this->tarFile->__toString() . " is up to date.", PROJECT_MSG_INFO)
    210                 return; 
    211            
    212  
     205            // check if tar is out of date with respect to each fileset 
     206            if($this->tarFile->exists()) { 
     207                   $upToDate = true; 
     208                   foreach($this->filesets as $fs) { 
     209                       $files = $fs->getFiles($this->project, $this->includeEmpty); 
     210                       if (!$this->archiveIsUpToDate($files, $fs->getDir($this->project))) { 
     211                           $upToDate = false; 
     212                       } 
     213                       for ($i=0, $fcount=count($files); $i < $fcount; $i++) { 
     214                           if ($this->tarFile->equals(new PhingFile($fs->getDir($this->project), $files[$i]))) { 
     215                               throw new BuildException("A tar file cannot include itself", $this->getLocation()); 
     216                           } 
     217                       } 
     218                   } 
     219                    if ($upToDate) { 
     220                        $this->log("Nothing to do: " . $this->tarFile->__toString() . " is up to date.", PROJECT_MSG_INFO); 
     221                       return
     222                    } 
     223                       
     224                         
    213225            $this->log("Building tar: " . $this->tarFile->__toString(), PROJECT_MSG_INFO); 
    214226             
     
    219231             
    220232            foreach($this->filesets as $fs) {                                 
    221                     $files = $fs->getFiles($this->project); 
     233                    $files = $fs->getFiles($this->project, $this->includeEmpty); 
    222234                    if (count($files) > 1 && strlen($fs->getFullpath()) > 0) { 
    223235                        throw new BuildException("fullpath attribute may only " 
     
    226238                                                 . "single file."); 
    227239                    } 
    228                     // FIXME  
    229                     // Current model is only adding directories implicitly.  This 
    230                     // won't add any empty directories.  Perhaps modify TarFileSet::getFiles() 
    231                     // to also include empty directories.  Not high priority, since non-inclusion 
    232                     // of empty dirs is probably not unexpected behavior for TarTask. 
    233240                    $fsBasedir = $fs->getDir($this->project); 
    234241                    $filesToTar = array(); 
     
    289296     *    the baseDir for the project. 
    290297     */ 
    291     public function getFiles(Project $p) { 
     298    public function getFiles(Project $p, $includeEmpty = true) { 
     299     
    292300        if ($this->files === null) { 
     301         
    293302            $ds = $this->getDirectoryScanner($p); 
    294303            $this->files = $ds->getIncludedFiles(); 
    295         } 
     304             
     305            if ($includeEmpty) { 
     306             
     307                    // first any empty directories that will not be implicitly added by any of the files 
     308                                $implicitDirs = array(); 
     309                                foreach($this->files as $file) { 
     310                                        $implicitDirs[] = dirname($file); 
     311                                }  
     312                                 
     313                                $incDirs = $ds->getIncludedDirectories(); 
     314                                 
     315                                // we'll need to add to that list of implicit dirs any directories 
     316                                // that contain other *directories* (and not files), since otherwise 
     317                                // we get duplicate directories in the resulting tar 
     318                                foreach($incDirs as $dir) { 
     319                                        foreach($incDirs as $dircheck) { 
     320                                                if (!empty($dir) && $dir == dirname($dircheck)) { 
     321                                                        $implicitDirs[] = $dir; 
     322                                                } 
     323                                        } 
     324                                } 
     325                                 
     326                                $implicitDirs = array_unique($implicitDirs); 
     327                                 
     328                                // Now add any empty dirs (dirs not covered by the implicit dirs) 
     329                                // to the files array.  
     330                                 
     331                                foreach($incDirs as $dir) { // we cannot simply use array_diff() since we want to disregard empty/. dirs 
     332                                        if ($dir != "" && $dir != "." && !in_array($dir, $implicitDirs)) { 
     333                                                // it's an empty dir, so we'll add it. 
     334                                                $this->files[] = $dir; 
     335                                        } 
     336                                } 
     337                        } // if $includeEmpty 
     338                         
     339        } // if ($this->files===null) 
     340         
    296341        return $this->files; 
    297342    } 
  • trunk/classes/phing/tasks/ext/UntarTask.php

    r107 r116  
    4343    protected function extractArchive(PhingFile $tarfile) 
    4444    { 
    45         $this->log("Extracting tar file: " . $tarfile->__toString() . ' to ' . $this->destDir->__toString(), PROJECT_MSG_INFO); 
     45        $this->log("Extracting tar file: " . $tarfile->__toString() . ' to ' . $this->todir->__toString(), PROJECT_MSG_INFO); 
    4646         
    4747        try { 
    4848                $tar = $this->initTar($tarfile); 
    49                 if(!$tar->extract($this->destDir->getAbsolutePath())) { 
    50                    throw new BuildException('Failed to extract tar file: ' . $tar->errorInfo(true)); 
     49                if(!$tar->extractModify($this->todir->getAbsolutePath(), $this->removepath)) { 
     50                    throw new BuildException('Failed to extract tar file: ' . $tarfile->getAbsolutePath()); 
    5151                } 
    5252        } catch (IOException $ioe) { 
     
    5656    } 
    5757     
    58     /** 
    59      * @param array $files array of filenames 
    60      * @param PhingFile $dir 
    61      * @return boolean 
    62      */ 
    63     protected function isDestinationUpToDate(PhingFile $tarfile) { 
    64         if (!$tarfile->exists()) { 
    65                 throw new BuildException("Could not find file " . $tarfile->__toString() . " to untar."); 
    66         } 
    67          
     58    protected function listArchiveContent(PhingFile $tarfile) 
     59    { 
    6860        $tar = $this->initTar($tarfile); 
    69         $tarContents = $tar->listContent(); 
    70         if(is_array($tarContents)) { 
    71             /* Get first file/dir to match against destination directory path to find 
    72                when the file was last unziped */ 
    73             $firstPathInfo = current($tarContents); 
    74             $firstPath = new PhingFile($this->destDir, $firstPathInfo['filename']); 
    75              
    76             $fileSystem = FileSystem::getFileSystem(); 
    77             if(!$firstPath->exists() || $fileSystem->compareMTimes($tarfile->getCanonicalPath(), $firstPath->getCanonicalPath()) == 1) { 
    78                 return false; 
    79             } 
    80         } 
    81          
    82         return true; 
     61        return $tar->listContent(); 
    8362    } 
    8463     
  • trunk/classes/phing/tasks/ext/UnzipTask.php

    r107 r116  
    3636    protected function extractArchive(PhingFile $zipfile) 
    3737    { 
    38         $extractParams = array('add_path' => $this->destDir->getAbsolutePath()); 
    39         $this->log("Extracting zip: " . $zipfile->__toString() . ' to ' . $this->destDir->__toString(), PROJECT_MSG_INFO); 
     38        $extractParams = array('add_path' => $this->todir->getAbsolutePath()); 
     39        if(!empty($this->removepath)) 
     40        { 
     41            $extractParams['remove_path'] = $this->removepath; 
     42        } 
     43         
     44        $this->log("Extracting zip: " . $zipfile->__toString() . ' to ' . $this->todir->__toString(), PROJECT_MSG_INFO); 
    4045         
    4146        try { 
     
    4550                if(is_array($extractResponse)) { 
    4651                    foreach ($extractResponse as $extractedPath) { 
    47                         $this->log('Extracted' . $extractedPath['stored_filename'] . ' to ' . $this->destDir->__toString(), PROJECT_MSG_VERBOSE); 
     52                        $this->log('Extracted' . $extractedPath['stored_filename'] . ' to ' . $this->todir->__toString(), PROJECT_MSG_VERBOSE); 
    4853                    } 
    4954                } else if ($extractResponse === 0) { 
     
    5661    } 
    5762     
    58     /** 
    59      * @param array $files array of filenames 
    60      * @param PhingFile $dir 
    61      * @return boolean 
    62      */ 
    63     protected function isDestinationUpToDate(PhingFile $zipfile) { 
    64         if (!$zipfile->exists()) { 
    65                 throw new BuildException("Could not find file " . $zipfile->__toString() . " to unzip."); 
    66         } 
    67          
     63    protected function listArchiveContent(PhingFile $zipfile) 
     64    { 
    6865        $zip = new Archive_Zip($zipfile->getAbsolutePath()); 
    69         $zipContents = $zip->listContent(); 
    70         if(is_array($zipContents)) { 
    71             /* Get first file/dir to match against destination directory path to find 
    72                when the file was last unziped */ 
    73             $firstPathInfo = current($zipContents); 
    74             $firstPath = new PhingFile($this->destDir, $firstPathInfo['filename']); 
    75              
    76             $fileSystem = FileSystem::getFileSystem(); 
    77             if(!$firstPath->exists() || $fileSystem->compareMTimes($zipfile->getCanonicalPath(), $firstPath->getCanonicalPath()) == 1) { 
    78                 return false; 
    79             } 
    80         } 
    81          
    82         return true; 
     66        return $zip->listContent(); 
    8367    } 
    8468} 
  • trunk/classes/phing/tasks/ext/ZipTask.php

    r81 r116  
    148148                    $f = new PhingFile($fsBasedir, $files[$i]); 
    149149                    $filesToZip[] = $f->getAbsolutePath();                         
    150                 }                     
    151                 $zip->add($filesToZip, array('remove_path' => $fsBasedir->getPath())); 
     150                } 
     151                $zip->add($filesToZip, array('remove_path' => $fsBasedir->getCanonicalPath())); 
    152152            } 
    153153                          
  • trunk/classes/phing/tasks/ext/coverage/CoverageReportTask.php

    r81 r116  
    232232        protected function transformCoverageInformation($filename, $coverageInformation) 
    233233        { 
     234                // Strip last line of coverage information 
     235                end($coverageInformation); 
     236                unset($coverageInformation[key($coverageInformation)]); 
     237                 
    234238                $classes = PHPUnit2Util::getDefinedClasses($filename, $this->classpath); 
    235239                 
     
    251255                                $methodscovered = 0; 
    252256                                $methodcount = 0; 
    253                                  
    254                                 end($coverageInformation); 
    255                                 unset($coverageInformation[key($coverageInformation)]); 
    256257                                 
    257258                                // Strange PHP5 reflection bug, classes without parent class or implemented interfaces seem to start one line off 
     
    293294                                        $linenr = key($coverageInformation); 
    294295 
    295                                         while ($linenr < $method->getStartLine()) 
     296                                        while ($linenr !== null && $linenr < $method->getStartLine()) 
    296297                                        { 
    297298                                                next($coverageInformation); 
  • trunk/classes/phing/tasks/ext/phpunit2/BatchTest.php

    r81 r116  
    159159                foreach ($filenames as $filename) 
    160160                { 
    161                         $definedClasses = PHPUnit2Util::getDefinedClasses($filename); 
     161                        $definedClasses = PHPUnit2Util::getDefinedClasses($filename, $this->classpath); 
    162162                         
    163163                        $declaredClasses = array_merge($declaredClasses, $definedClasses); 
  • trunk/classes/phing/tasks/system/ExecTask.php

    r43 r116  
    191191     
    192192    /** 
    193      * Specify the workign directory for executing this command. 
     193     * Specify the working directory for executing this command. 
    194194     * @param PhingFile $dir 
    195195     */ 
  • trunk/docs/phing_guide/book/chapters/ProjectComponents.html

    r1 r116  
    355355  C</a>.</p> 
    356356 
     357<h2><a name="Conditions">Conditions</a></h2> 
     358 
     359<p>Conditions are nested elements of the  
     360<a href="appendixes/AppendixB-CoreTasks.html#ConditionTask">condition</code></a> and 
     361<a href="appendixes/AppendixB-CoreTasks.html#IfTask">if</a> tasks. 
     362</p> 
     363 
     364<h4>not</h4> 
     365<p>The <code>&lt;not&gt;</code> element expects exactly one other 
     366condition to be nested into this element, negating the result of the 
     367condition. It doesn't have any attributes and accepts all nested 
     368elements of the condition task as nested elements as well.</p> 
     369 
     370<h4>and</h4> <p> 
     371The <code>&lt;and&gt;</code> element doesn't have any attributes and 
     372accepts an arbitrary number of conditions as nested elements. This condition 
     373is true if all of its contained conditions are, conditions will be 
     374evaluated in the order they have been specified in the build file.</p> 
     375 
     376<p>The <code>&lt;and&gt;</code> condition has the same shortcut 
     377semantics as the &amp;&amp; operator in some programming languages, as soon as one of the 
     378nested conditions is false, no other condition will be evaluated.</p> 
     379 
     380<h4>or</h4> <p> 
     381The <code>&lt;or&gt;</code> element doesn't have any attributes and 
     382accepts an arbitrary number of conditions as nested elements. This condition 
     383is true if at least one of its contained conditions is, conditions 
     384will be evaluated in the order they have been specified in the build 
     385file.</p> 
     386 
     387<p>The <code>&lt;or&gt;</code> condition has the same 
     388shortcut semantics as the || operator in some programming languages, as soon as one of the 
     389nested conditions is true, no other condition will be evaluated.</p> 
     390 
     391<h4>available</h4> 
     392<p>This condition is identical to the <a 
     393href="appendixes/AppendixB-CoreTasks.html#AvailableTask">Available</a> task, all attributes and nested 
     394elements of that task are supported, the property and value attributes 
     395are redundant and will be ignored.</p> 
     396 
     397<h4>uptodate</h4> 
     398<p>This condition is identical to the <a 
     399href="appendixes/AppendixB-CoreTasks.html#UpToDateTask">UpToDate</a> task, all attributes and nested 
     400elements of that task are supported, the property and value attributes 
     401are redundant and will be ignored.</p> 
     402 
     403<h4>os</h4> 
     404<p>Test whether the current operating system is of a given type.</p> 
     405 
     406<table border="1" cellpadding="2" cellspacing="0"> 
     407  <tr> 
     408    <td valign="top"><b>Attribute</b></td> 
     409    <td valign="top"><b>Description</b></td> 
     410    <td align="center" valign="top"><b>Required</b></td> 
     411  </tr> 
     412  <tr> 
     413    <td valign="top">family</td> 
     414    <td valign="top">The name of the operating system family to expect.</td> 
     415    <td valign="top" align="center">Yes</td> 
     416  </tr> 
     417</table> 
     418<p>Supported values for the family attribute are: 
     419<ul> 
     420  <li>windows (for all versions of Microsoft Windows)</li> 
     421  <li>mac (for all Apple Macintosh systems)</li> 
     422  <li>unix (for all Unix and Unix-like operating systems)</li> 
     423</ul> 
     424 
     425<h4>equals</h4> 
     426<p>Tests whether the two given Strings are identical</p> 
     427<table border="1" cellpadding="2" cellspacing="0"> 
     428  <tr> 
     429    <td valign="top"><b>Attribute</b></td> 
     430    <td valign="top"><b>Description</b></td> 
     431    <td align="center" valign="top"><b>Required</b></td> 
     432  </tr> 
     433  <tr> 
     434    <td valign="top">arg1</td> 
     435    <td valign="top">First string to test.</td> 
     436    <td valign="top" align="center">Yes</td> 
     437  </tr> 
     438  <tr> 
     439    <td valign="top">arg2</td> 
     440    <td valign="top">Second string to test.</td> 
     441    <td valign="top" align="center">Yes</td> 
     442  </tr> 
     443  <tr> 
     444    <td valign="top">casesensitive</td> 
     445    <td valign="top">Perform a case sensitive comparision.  Default is 
     446        true.</td> 
     447    <td valign="top" align="center">No</td> 
     448  </tr> 
     449  <tr> 
     450    <td valign="top">trim</td> 
     451    <td valign="top">Trim whitespace from arguments before comparing 
     452        them.  Default is false.</td> 
     453    <td valign="top" align="center">No</td> 
     454  </tr> 
     455</table> 
     456 
     457<h4>isset</h4> 
     458<p>Test whether a given property has been set in this project.</p> 
     459<table border="1" cellpadding="2" cellspacing="0"> 
     460  <tr> 
     461    <td valign="top"><b>Attribute</b></td> 
     462    <td valign="top"><b>Description</b></td> 
     463    <td align="center" valign="top"><b>Required</b></td> 
     464  </tr> 
     465  <tr> 
     466    <td valign="top">property</td> 
     467    <td valign="top">The name of the property to test.</td> 
     468    <td valign="top" align="center">Yes</td> 
     469  </tr> 
     470</table> 
     471 
     472<h4>contains</h4> 
     473<p>Tests whether a string contains another one.</p> 
     474<table border="1" cellpadding="2" cellspacing="0"> 
     475  <tr> 
     476    <td valign="top"><b>Attribute</b></td> 
     477    <td valign="top"><b>Description</b></td> 
     478    <td align="center" valign="top"><b>Required</b></td> 
     479  </tr> 
     480  <tr> 
     481    <td valign="top">string</td> 
     482    <td valign="top">The string to search in.</td> 
     483    <td valign="top" align="center">Yes</td> 
     484  </tr> 
     485  <tr> 
     486    <td valign="top">substring</td> 
     487    <td valign="top">The string to search for.</td> 
     488    <td valign="top" align="center">Yes</td> 
     489  </tr> 
     490  <tr> 
     491    <td valign="top">casesensitive</td> 
     492    <td valign="top">Perform a case sensitive comparision.  Default is 
     493        true.</td> 
     494    <td valign="top" align="center">No</td> 
     495  </tr> 
     496</table> 
     497 
     498<h4>istrue</h4> 
     499<p>Tests whether a string evals to true.</p> 
     500 
     501<table border="1" cellpadding="2" cellspacing="0"> 
     502  <tr> 
     503    <td valign="top"><b>Attribute</b></td> 
     504    <td valign="top"><b>Description</b></td> 
     505    <td align="center" valign="top"><b>Required</b></td> 
     506  </tr> 
     507  <tr> 
     508    <td valign="top">value</td> 
     509    <td valign="top">value to test</td> 
     510    <td valign="top" align="center">Yes</td> 
     511  </tr> 
     512</table> 
     513<pre> 
     514    &lt;istrue value=&quot;${someproperty}&quot;/&gt; 
     515    &lt;istrue value=&quot;false&quot;/&gt; 
     516</pre> 
     517 
     518<h4>isfalse</h4> 
     519<p>Tests whether a string evals to not true, the negation of &lt;istrue&gt; 
     520</p> 
     521<table border="1" cellpadding="2" cellspacing="0"> 
     522  <tr> 
     523    <td valign="top"><b>Attribute</b></td> 
     524    <td valign="top"><b>Description</b></td> 
     525    <td align="center" valign="top"><b>Required</b></td> 
     526  </tr> 
     527  <tr> 
     528    <td valign="top">value</td> 
     529    <td valign="top">value to test</td> 
     530    <td valign="top" align="center">Yes</td> 
     531  </tr> 
     532</table> 
     533<pre> 
     534    &lt;isfalse value=&quot;${someproperty}&quot;/&gt; 
     535    &lt;isfalse value=&quot;false&quot;/&gt; 
     536</pre> 
     537 
    357538</body> 
    358539</html> 
  • trunk/docs/phing_guide/book/chapters/appendixes/AppendixB-CoreTasks.html

    r115 r116  
    227227 
    228228<h2><a name="CallTargetTask"></a>CallTargetTask</h2> 
    229 <p> The CallTargetTask calls a target from the same project. A <em>&lt;project&gt;</em> 
     229<p> The CallTargetTask calls a target from the same project. A <em>&lt;phingcall&gt;</em> 
    230230  tag may contain <em>&lt;property&gt;</em> tags that define new properties. In 
    231231  the following example, the properties <em>property1</em> and <em>foo</em> are 
     
    296296</p> 
    297297--> 
     298 
     299<h2><a name="ConditionTask"></a>ConditionTask</h2> 
     300<p>Sets a property if a certain condition holds true - this is a 
     301        generalization of <a href="#AvailableTask">Available</a> and  
     302        <a href="#UpToDateTask">UpToDate</a>.</p> 
     303<p>If the condition holds true, the property value is set to true by 
     304        default; otherwise, the property is not set. You can set the value to 
     305        something other than the default by specifying the <code>value</code> 
     306        attribute.</p> 
     307<p>Conditions are specified as nested elements, you must specify exactly  
     308        one condition - see the <a href="../ProjectComponents.html#Conditions">documentation</a>  
     309        for a complete list of nested elements.</p> 
     310<h3>Example</h3> 
     311<pre> 
     312&lt;condition property="isMacOrWindows"&gt; 
     313    &lt;and&gt; 
     314      &lt;os family="mac"/&gt; 
     315      &lt;os family="windows"/&gt; 
     316    &lt;/and&gt; 
     317  &lt;/condition&gt; 
     318</pre> 
     319<h3>Attributes</h3> 
     320<table> 
     321  <thead> 
     322    <tr> 
     323      <th>Name</th> 
     324      <th>Type</th> 
     325      <th>Description</th> 
     326      <th>Default</th> 
     327      <th>Required</th> 
     328    </tr> 
     329  </thead> 
     330  <tbody> 
     331    <tr> 
     332      <td>property</td> 
     333      <td>String</td> 
     334      <td>The name of the property to set.</td> 
     335      <td>n/a</td> 
     336      <td>Yes</td> 
     337    </tr> 
     338    <tr> 
     339      <td>value</td> 
     340      <td>String</td> 
     341      <td>The value to set the property to. Defaults to "true".</td> 
     342      <td>true</td> 
     343      <td>No</td> 
     344    </tr> 
     345  </tbody> 
     346</table> 
    298347 
    299348<h2><a name="CopyTask"></a>CopyTask</h2> 
     
    424473</p> 
    425474<h3>Example</h3> 
    426 <pre>&lt;-- Delete a specific file from a directory --&gt; 
    427 &lt;delete file=&quot;foo.bar&quot; dir=&quot;/tmp&quot; /&gt; 
     475<pre>&lt;-- Delete a specific file --&gt; 
     476&lt;delete file=&quot;/tmp/foo.bar&quot; /&gt; 
    428477 
    429478&lt;-- Delete a directory --&gt; 
    430479&lt;delete dir=&quot;/tmp/darl&quot; includeemptydirs=&quot;true&quot; verbose=&quot;true&quot; failonerror=&quot;true&quot; /&gt; 
     480 
     481&lt;-- Delete using a fileset --&gt; 
     482&lt;delete&gt; 
     483  &lt;fileset dir=&quot;/tmp&quot;&gt; 
     484    &lt;include name=&quot;*.bar&quot; /&gt; 
     485  &lt;/fileset&gt; 
     486&lt;/delete&gt; 
    431487</pre> 
    432488<h3>Attributes</h3> 
     
    447503      <td> 
    448504        The file that is to be deleted. You either have to specify 
    449         this attribute, or <em>dir</em> or both
     505       this attribute, <em>dir</em>, or use a fileset
    450506      </td> 
    451507      <td>n/a</td> 
     
    457513      <td> 
    458514        The directory that is to be deleted. You either have to specify 
    459         this attribute, or <em>file</em> or both
     515        this attribute, <em>file</em>, or use a fileset
    460516      </td> 
    461517      <td>n/a</td> 
     
    603659 
    604660&lt;-- List the contents of &quot;/tmp&quot; out to a file. --&gt; 
    605 &lt;exec command=&quot;ls -l&quot; &quot;/tmp &gt; foo.out&quot; escape=&quot;false&quot; /&gt; 
    606  
     661&lt;exec command=&quot;ls -l /tmp &gt; foo.out&quot; escape=&quot;false&quot; /&gt; 
    607662</pre> 
    608663<h3>Attributes</h3> 
     
    630685      <td> The directory the command is to be executed in. </td> 
    631686      <td>n/a</td> 
    632       <td>Yes</td> 
     687      <td>No</td> 
    633688    </tr> 
    634689    <tr> 
     
    779834</table> 
    780835 
     836<h2><a name="IfTask"></a>IfTask</h2> 
     837<p>Perform some tasks based on whether a given condition holds true or not.</p> 
     838<h3>Attributes</h3> 
     839<p> 
     840This task doesn't have any attributes, the condition to test is specified by a nested 
     841        element - see the <a href="../ProjectComponents.html#Conditions">documentation</a>  
     842        for a complete list of nested elements.</p> 
     843<p>Just like the <code>&lt;condition&gt;</code> task, only a 
     844    single condition can be specified - you combine them using 
     845    <code>&lt;and&gt;</code> or <code>&lt;or&gt;</code> 
     846    conditions.</p> 
     847<p>In addition to the condition, you can specify three different 
     848    child elements, <code>&lt;elseif&gt;</code>, <code>&lt;then&gt;</code> and 
     849    <code>&lt;else&gt;</code>.  All three subelements are optional. 
     850 
     851    Both <code>&lt;then&gt;</code> and <code>&lt;else&gt;</code> must not be 
     852    used more than once inside the if task. Both are 
     853    containers for Phing tasks.</p> 
     854 
     855<p>The <code>&lt;elseif&gt;</code> behaves exactly like an <code>&lt;if&gt;</code> 
     856    except that it cannot contain the <code>&lt;else&gt;</code> element 
     857    inside of it.  You may specify as may of these as you like, and the 
     858    order they are specified is the order they are evaluated in.  If the 
     859    condition on the <code>&lt;if&gt;</code> is false, then the first 
     860    <code>&lt;elseif&gt;</code> who's conditional evaluates to true 
     861    will be executed.  The <code>&lt;else&gt;</code> will be executed 
     862    only if the <code>&lt;if&gt;</code> and all <code>&lt;elseif&gt;</code> 
     863    conditions are false.</p> 
     864<h3>Example</h3> 
     865<pre> 
     866&lt;if&gt; 
     867 &lt;equals arg1="${foo}" arg2="bar" /&gt; 
     868 &lt;then&gt; 
     869   &lt;echo message="The value of property foo is bar" /&gt; 
     870 &lt;/then&gt; 
     871 &lt;else&gt; 
     872   &lt;echo message="The value of property foo is not bar" /&gt; 
     873 &lt;/else&gt; 
     874&lt;/if&gt; 
     875</pre> 
     876 
     877<pre> 
     878&lt;if&gt; 
     879 &lt;equals arg1="${foo}" arg2="bar" /&gt; 
     880 &lt;then&gt; 
     881   &lt;echo message="The value of property foo is 'bar'" /&gt; 
     882 &lt;/then&gt; 
     883 
     884 &lt;elseif&gt; 
     885  &lt;equals arg1="${foo}" arg2="foo" /&gt; 
     886  &lt;then&gt; 
     887   &lt;echo message="The value of property foo is 'foo'" /&gt; 
     888  &lt;/then&gt; 
     889