File tasks

Pyrus allows special handling of files through tasks. File tasks can perform any action necessary both when installing a package and when creating a package. Both Pyrus and the PEAR Installer ship with 4 built-in tasks, replace, windowseol, unixeol, and postinstallscript.

The built-in tasks are documented here. The documentation also describes how to create custom tasks for the PEAR Installer. Custom tasks for Pyrus are documented here.

Tasks are specifically designed to allow customization of an installation, and particularly modification of a specific file's contents. The unixeol task, for instance, transforms line endings to UNIX \n and is useful for shell scripts that must have the proper line endings. The replace task can be used to update the version of a package directly in the source code, or to automatically set up the path to a PEAR Installation in a shell script.

Tasks are defined using the XML namespace http://pear.php.net/dtd/tasks-1.0. Most often, this is declared using tasks as the namespace prefix, as in xmlns:tasks="http://pear.php.net/dtd/tasks-1.0". More than one task can be used for a single file, as shown by this example from the PEAR package:

    <file name="pearcmd.php" role="php">
     <tasks:replace from="@php_bin@" to="php_bin" type="pear-config" />
     <tasks:replace from="@php_dir@" to="php_dir" type="pear-config" />
     <tasks:replace from="@pear_version@" to="version" type="package-info" />
     <tasks:replace from="@include_path@" to="php_dir" type="pear-config" />
    </file>
File roles (Previous) Installation (Pyrus) (Next)
Last updated: Sat, 16 Feb 2019 — Download Documentation
Do you think that something on this page is wrong? Please file a bug report.
View this page in:
  • English

User Notes:

There are no user contributed notes for this page.