Changeset 116
- Timestamp:
- 09/12/06 09:32:50 (2 years ago)
- Files:
-
- trunk/CHANGELOG (modified) (2 diffs)
- trunk/classes/phing/tasks/defaults.properties (modified) (2 diffs)
- trunk/classes/phing/tasks/ext/ExtractBaseTask.php (copied) (copied from branches/2.2/classes/phing/tasks/ext/ExtractBaseTask.php) (7 diffs)
- trunk/classes/phing/tasks/ext/TarTask.php (modified) (7 diffs)
- trunk/classes/phing/tasks/ext/UntarTask.php (copied) (copied from branches/2.2/classes/phing/tasks/ext/UntarTask.php) (2 diffs)
- trunk/classes/phing/tasks/ext/UnzipTask.php (copied) (copied from branches/2.2/classes/phing/tasks/ext/UnzipTask.php) (3 diffs)
- trunk/classes/phing/tasks/ext/ZipTask.php (modified) (1 diff)
- trunk/classes/phing/tasks/ext/coverage/CoverageReportTask.php (modified) (3 diffs)
- trunk/classes/phing/tasks/ext/phpunit2/BatchTest.php (modified) (1 diff)
- trunk/classes/phing/tasks/system/ExecTask.php (modified) (1 diff)
- trunk/docs/phing_guide/book/chapters/ProjectComponents.html (modified) (1 diff)
- trunk/docs/phing_guide/book/chapters/appendixes/AppendixB-CoreTasks.html (modified) (13 diffs)
- trunk/docs/phing_guide/book/chapters/appendixes/AppendixC-OptionalTasks.html (modified) (7 diffs)
- trunk/docs/phing_guide/book/toc/FrameToC.html (modified) (4 diffs)
- trunk/docs/phing_guide/book/toc/ToC.html (modified) (4 diffs)
- trunk/etc/coverage-frames.xsl (modified) (1 diff)
- trunk/pear/build.xml (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/CHANGELOG
r115 r116 3 3 4 4 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) 5 Aut. 21, 2006 - Phing 2.2.0 8 6 9 7 * Refactored parser to support many tags as children of base <project> tag (HL) … … 43 41 updated documentation for the CoverageSetupTask 44 42 43 * Added Unzip and Untar tasks contributed by Joakim Bodin 45 44 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 46 61 Sept. 18, 2005 - Phing 2.1.1 47 62 trunk/classes/phing/tasks/defaults.properties
r69 r116 11 11 available=phing.tasks.system.AvailableTask 12 12 chmod=phing.tasks.system.ChmodTask 13 concat=phing.tasks.system.AppendTask 13 14 condition=phing.tasks.system.ConditionTask 14 15 copy=phing.tasks.system.CopyTask … … 48 49 capsule=phing.tasks.ext.CapsuleTask 49 50 tar=phing.tasks.ext.TarTask 51 untar=phing.tasks.ext.UntarTask 50 52 pearpkg=phing.tasks.ext.PearPackageTask 51 53 pearpkg2=phing.tasks.ext.PearPackage2Task 52 54 mail=phing.tasks.ext.MailTask 53 55 zip=phing.tasks.ext.ZipTask 56 unzip=phing.tasks.ext.UnzipTask 54 57 55 58 ; "ext" tasks trunk/classes/phing/tasks/ext/ExtractBaseTask.php
r107 r116 30 30 */ 31 31 abstract class ExtractBaseTask extends MatchingTask { 32 /** 33 * @var PhingFile $file 34 */ 32 35 protected $file; 33 protected $destDir; 36 /** 37 * @var PhingFile $todir 38 */ 39 protected $todir; 40 protected $removepath; 34 41 protected $filesets = array(); // all fileset objects assigned to this task 35 42 … … 56 63 * @param PhingFile $baseDir 57 64 */ 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; 60 72 } 61 73 … … 68 80 $this->validateAttributes(); 69 81 70 $destinationFileSet = new FileSet();71 $destinationFileSet->setDir($this->destDir);72 $destinationDirScanner = $destinationFileSet->getDirectoryScanner($this->project);73 $destinationFiles = $destinationDirScanner->getIncludedFiles();74 75 82 $filesToExtract = array(); 76 83 if ($this->file !== null) { … … 78 85 $filesToExtract[] = $this->file; 79 86 } 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); 81 88 } 82 89 } … … 97 104 $filesToExtract[] = $compressedArchiveFile; 98 105 } 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); 100 107 } 101 108 } … … 109 116 abstract protected function extractArchive(PhingFile $compressedArchiveFile); 110 117 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); 112 152 113 153 /** … … 124 164 } 125 165 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."); 128 168 } 129 169 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."); 132 172 } 133 173 trunk/classes/phing/tasks/ext/TarTask.php
r43 r116 45 45 private $tarFile; 46 46 private $baseDir; 47 47 private $includeEmpty = true; // Whether to include empty dirs in the TAR 48 48 49 private $longFileMode = "warn"; 49 50 … … 106 107 public function setBasedir(PhingFile $baseDir) { 107 108 $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; 108 119 } 109 120 … … 178 189 throw new BuildException("basedir does not exist!", $this->getLocation()); 179 190 } 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 } 185 197 } 186 198 … … 191 203 } 192 204 193 // check if tar is out of date with respect to each 194 // fileset195 $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 213 225 $this->log("Building tar: " . $this->tarFile->__toString(), PROJECT_MSG_INFO); 214 226 … … 219 231 220 232 foreach($this->filesets as $fs) { 221 $files = $fs->getFiles($this->project );233 $files = $fs->getFiles($this->project, $this->includeEmpty); 222 234 if (count($files) > 1 && strlen($fs->getFullpath()) > 0) { 223 235 throw new BuildException("fullpath attribute may only " … … 226 238 . "single file."); 227 239 } 228 // FIXME229 // Current model is only adding directories implicitly. This230 // won't add any empty directories. Perhaps modify TarFileSet::getFiles()231 // to also include empty directories. Not high priority, since non-inclusion232 // of empty dirs is probably not unexpected behavior for TarTask.233 240 $fsBasedir = $fs->getDir($this->project); 234 241 $filesToTar = array(); … … 289 296 * the baseDir for the project. 290 297 */ 291 public function getFiles(Project $p) { 298 public function getFiles(Project $p, $includeEmpty = true) { 299 292 300 if ($this->files === null) { 301 293 302 $ds = $this->getDirectoryScanner($p); 294 303 $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 296 341 return $this->files; 297 342 } trunk/classes/phing/tasks/ext/UntarTask.php
r107 r116 43 43 protected function extractArchive(PhingFile $tarfile) 44 44 { 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); 46 46 47 47 try { 48 48 $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()); 51 51 } 52 52 } catch (IOException $ioe) { … … 56 56 } 57 57 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 { 68 60 $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(); 83 62 } 84 63 trunk/classes/phing/tasks/ext/UnzipTask.php
r107 r116 36 36 protected function extractArchive(PhingFile $zipfile) 37 37 { 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); 40 45 41 46 try { … … 45 50 if(is_array($extractResponse)) { 46 51 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); 48 53 } 49 54 } else if ($extractResponse === 0) { … … 56 61 } 57 62 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 { 68 65 $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(); 83 67 } 84 68 } trunk/classes/phing/tasks/ext/ZipTask.php
r81 r116 148 148 $f = new PhingFile($fsBasedir, $files[$i]); 149 149 $filesToZip[] = $f->getAbsolutePath(); 150 } 151 $zip->add($filesToZip, array('remove_path' => $fsBasedir->get Path()));150 } 151 $zip->add($filesToZip, array('remove_path' => $fsBasedir->getCanonicalPath())); 152 152 } 153 153 trunk/classes/phing/tasks/ext/coverage/CoverageReportTask.php
r81 r116 232 232 protected function transformCoverageInformation($filename, $coverageInformation) 233 233 { 234 // Strip last line of coverage information 235 end($coverageInformation); 236 unset($coverageInformation[key($coverageInformation)]); 237 234 238 $classes = PHPUnit2Util::getDefinedClasses($filename, $this->classpath); 235 239 … … 251 255 $methodscovered = 0; 252 256 $methodcount = 0; 253 254 end($coverageInformation);255 unset($coverageInformation[key($coverageInformation)]);256 257 257 258 // Strange PHP5 reflection bug, classes without parent class or implemented interfaces seem to start one line off … … 293 294 $linenr = key($coverageInformation); 294 295 295 while ($linenr < $method->getStartLine())296 while ($linenr !== null && $linenr < $method->getStartLine()) 296 297 { 297 298 next($coverageInformation); trunk/classes/phing/tasks/ext/phpunit2/BatchTest.php
r81 r116 159 159 foreach ($filenames as $filename) 160 160 { 161 $definedClasses = PHPUnit2Util::getDefinedClasses($filename );161 $definedClasses = PHPUnit2Util::getDefinedClasses($filename, $this->classpath); 162 162 163 163 $declaredClasses = array_merge($declaredClasses, $definedClasses); trunk/classes/phing/tasks/system/ExecTask.php
r43 r116 191 191 192 192 /** 193 * Specify the worki gndirectory for executing this command.193 * Specify the working directory for executing this command. 194 194 * @param PhingFile $dir 195 195 */ trunk/docs/phing_guide/book/chapters/ProjectComponents.html
r1 r116 355 355 C</a>.</p> 356 356 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><not></code> element expects exactly one other 366 condition to be nested into this element, negating the result of the 367 condition. It doesn't have any attributes and accepts all nested 368 elements of the condition task as nested elements as well.</p> 369 370 <h4>and</h4> <p> 371 The <code><and></code> element doesn't have any attributes and 372 accepts an arbitrary number of conditions as nested elements. This condition 373 is true if all of its contained conditions are, conditions will be 374 evaluated in the order they have been specified in the build file.</p> 375 376 <p>The <code><and></code> condition has the same shortcut 377 semantics as the && operator in some programming languages, as soon as one of the 378 nested conditions is false, no other condition will be evaluated.</p> 379 380 <h4>or</h4> <p> 381 The <code><or></code> element doesn't have any attributes and 382 accepts an arbitrary number of conditions as nested elements. This condition 383 is true if at least one of its contained conditions is, conditions 384 will be evaluated in the order they have been specified in the build 385 file.</p> 386 387 <p>The <code><or></code> condition has the same 388 shortcut semantics as the || operator in some programming languages, as soon as one of the 389 nested conditions is true, no other condition will be evaluated.</p> 390 391 <h4>available</h4> 392 <p>This condition is identical to the <a 393 href="appendixes/AppendixB-CoreTasks.html#AvailableTask">Available</a> task, all attributes and nested 394 elements of that task are supported, the property and value attributes 395 are redundant and will be ignored.</p> 396 397 <h4>uptodate</h4> 398 <p>This condition is identical to the <a 399 href="appendixes/AppendixB-CoreTasks.html#UpToDateTask">UpToDate</a> task, all attributes and nested 400 elements of that task are supported, the property and value attributes 401 are 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 <istrue value="${someproperty}"/> 515 <istrue value="false"/> 516 </pre> 517 518 <h4>isfalse</h4> 519 <p>Tests whether a string evals to not true, the negation of <istrue> 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 <isfalse value="${someproperty}"/> 535 <isfalse value="false"/> 536 </pre> 537 357 538 </body> 358 539 </html> trunk/docs/phing_guide/book/chapters/appendixes/AppendixB-CoreTasks.html
r115 r116 227 227 228 228 <h2><a name="CallTargetTask"></a>CallTargetTask</h2> 229 <p> The CallTargetTask calls a target from the same project. A <em><p roject></em>229 <p> The CallTargetTask calls a target from the same project. A <em><phingcall></em> 230 230 tag may contain <em><property></em> tags that define new properties. In 231 231 the following example, the properties <em>property1</em> and <em>foo</em> are … … 296 296 </p> 297 297 --> 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 <condition property="isMacOrWindows"> 313 <and> 314 <os family="mac"/> 315 <os family="windows"/> 316 </and> 317 </condition> 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> 298 347 299 348 <h2><a name="CopyTask"></a>CopyTask</h2> … … 424 473 </p> 425 474 <h3>Example</h3> 426 <pre><-- Delete a specific file from a directory-->427 <delete file=" foo.bar" dir="/tmp" />475 <pre><-- Delete a specific file --> 476 <delete file="/tmp/foo.bar" /> 428 477 429 478 <-- Delete a directory --> 430 479 <delete dir="/tmp/darl" includeemptydirs="true" verbose="true" failonerror="true" /> 480 481 <-- Delete using a fileset --> 482 <delete> 483 <fileset dir="/tmp"> 484 <include name="*.bar" /> 485 </fileset> 486 </delete> 431 487 </pre> 432 488 <h3>Attributes</h3> … … 447 503 <td> 448 504 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. 450 506 </td> 451 507 <td>n/a</td> … … 457 513 <td> 458 514 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. 460 516 </td> 461 517 <td>n/a</td> … … 603 659 604 660 <-- List the contents of "/tmp" out to a file. --> 605 <exec command="ls -l" "/tmp > foo.out" escape="false" /> 606 661 <exec command="ls -l /tmp > foo.out" escape="false" /> 607 662 </pre> 608 663 <h3>Attributes</h3> … … 630 685 <td> The directory the command is to be executed in. </td> 631 686 <td>n/a</td> 632 <td> Yes</td>687 <td>No</td> 633 688 </tr> 634 689 <tr> … … 779 834 </table> 780 835 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> 840 This 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><condition></code> task, only a 844 single condition can be specified - you combine them using 845 <code><and></code> or <code><or></code> 846 conditions.</p> 847 <p>In addition to the condition, you can specify three different 848 child elements, <code><elseif></code>, <code><then></code> and 849 <code><else></code>. All three subelements are optional. 850 851 Both <code><then></code> and <code><else></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><elseif></code> behaves exactly like an <code><if></code> 856 except that it cannot contain the <code><else></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><if></code> is false, then the first 860 <code><elseif></code> who's conditional evaluates to true 861 will be executed. The <code><else></code> will be executed 862 only if the <code><if></code> and all <code><elseif></code> 863 conditions are false.</p> 864 <h3>Example</h3> 865 <pre> 866 <if> 867 <equals arg1="${foo}" arg2="bar" /> 868 <then> 869 <echo message="The value of property foo is bar" /> 870 </then> 871 <else> 872 <echo message="The value of property foo is not bar" /> 873 </else> 874 </if> 875 </pre> 876 877 <pre> 878 <if> 879 <equals arg1="${foo}" arg2="bar" /> 880 <then> 881 <echo message="The value of property foo is 'bar'" /> 882 </then> 883 884 <elseif> 885 <equals arg1="${foo}" arg2="foo" /> 886 <then> 887 <echo message="The value of property foo is 'foo'" /> 888 </then> 889
