Re: [PEAR Installer] How to install a script?
| From: | Tomas V.V.Cox | Date: | Fri, 27 Jun 2003 03:18:18 +0000 |
| Subject: | Re: [PEAR Installer] How to install a script? | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-17772@lists.php.net to get a copy of this message | ||
On Friday, June 27, 2003 0:08, Pierre-Alain Joye wrote:
> On Thu, 26 Jun 2003 22:22:05 +0200
> Sebastian Bergmann <sebastian@php.net> wrote:
>> I want to add two scripts, "phpunit" and "phpunit.bat", to PHPUnit/
>> so that the PEAR Installer
>>
>> - installs them to the same directory the "pear" executable
>> resides
>> - makes them executable (on *NIX)
> A very good example is pear itself. In the last versions we use
> the same php script in both *nix and win32 command. Both commands
> contains custom data that are customized during the installation process
> using the replace feature.
For example:
<file role="script" install-as="pear" name="pear.sh">
<replace from="@php_bin@" to="php_bin"
type="pear-config"/>
<replace from="@php_dir@" to="php_dir"
type="pear-config"/>
<replace from="@pear_version@" to="version"
type="package-info"/>
<replace from="@include_path@" to="php_dir"
type="pear-config"/>
</file>
<file role="script" platform="windows" install-as="pear.bat"
name="pear.bat">
<replace from="@bin_dir@" to="bin_dir"
type="pear-config"/>
<replace from="@php_bin@" to="php_bin"
type="pear-config"/>
<replace from="@include_path@" to="php_dir"
type="pear-config"/>
</file>
The role "script" will install the file in the correct place with the
correct perms. You could set that a file has to be installed or not under
certain OS'es. Other feature is the replacements you can do to the
file. All the "from" strings you put inside your script will be
replaced with the string generated by the rule. The types of rules are:
- "pear-config": the "to" field contains the var from the config. You
can see the pear config vars with the command "pear config-show".
- "php-const": the value of the specified PHP Constant will be
replaced.
- "package-info": any info from the package.xml file could be set,
like 'version', 'name', 'summary'.
- <no type>: the "to" string will be litterally replaced.
Sorry I know this is heavily undocumented :-)
--
Tomas V.V.Cox mailto:cox@idecnet.com