Добро пожаловать на форум PHP программистов!
За последние 24 часа нас посетили 16486 программистов и 1671 робот. Сейчас ищут 1658 программистов ...

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>


Вернуться к: Basic concepts all PEAR users should understand

© 2024 «PHP.RU — Сообщество PHP-Программистов»
Главная | Форум | Реклама на сайте | Контакты VIP Сувениры
Разработка компании ODware