PHPマニュアル/PEARマニュアル | ユーザフォーラムで議論/質問 | マニュアル検索 | ハイライト | ハイライトオフ | ポータル | php spot

Pyrus Custom Commands: differences from PEAR | JavaScript入門&応用&リファレンスなら「JavaScriptist」


Pyrus Custom Commands: differences from PEAR


Custom commands have changed substantially in Pyrus. PEAR commands draw their information from Xml files located in the directory PEAR/Command and require all commands to be implemented in a single file. Pyrus is much more flexible on this account, and extends the custom XML format used to define commands. Because of this difference, it is theoretically possible to create custom commands that will work in both the PEAR Installer and in Pyrus, although the internal implementation of these commands will necessarily be quite different.

The biggest difference between how a custom command is implemented in Pyrus has to do with the new plugin system (documented here). Before reading any further, it may be a good idea to familiarize yourself with the way that plugins work in Pyrus by reading the documentation on plugins, then return back to finish reading about custom commands.

Here is PEAR's version of the xml for the install command:

<commands version="1.0">
  <summary>Install Package</summary>
    <doc>will overwrite newer installed packages</doc>
    <doc>do not check for recommended dependency version</doc>
    <doc>ignore dependencies, install anyway</doc>
    <doc>do not install files, only register the package as installed</doc>
    <doc>soft install, fail silently, or upgrade if already installed</doc>
    <doc>don&#039;t build C extensions</doc>
    <doc>request uncompressed files when downloading</doc>
    <doc>root directory used when installing files (ala PHP&#039;s INSTALL_ROOT), use packagingroot for RPM</doc>
    <doc>root directory used when packaging files, like RPM packaging</doc>
    <doc>force install even if there were errors</doc>
    <doc>install all required and optional dependencies</doc>
    <doc>install all required dependencies</doc>
    <doc>do not attempt to download any urls or contact channels</doc>
    <doc>Only list the packages that would be downloaded</doc>
  <doc>[channel/]&lt;package&gt; ...
Installs one or more PEAR packages.  You can specify a package to
install in four ways:

&quot;Package-1.0.tgz&quot; : installs from a local file

&quot;; : installs from
anywhere on the net.

&quot;package.xml&quot; : installs the package described in
package.xml.  Useful for testing, or for wrapping a PEAR package in
another package manager such as RPM.

&quot;Package[-version/state][.tar]&quot; : queries your default channel&#039;s server
({config master_server}) and downloads the newest package with
the preferred quality/state ({config preferred_state}).

To retrieve Package version 1.1, use &quot;Package-1.1,&quot; to retrieve
Package state beta, use &quot;Package-beta.&quot;  To retrieve an uncompressed
file, append .tar (make sure there is no file by the same name first)

To download a package from another channel, prefix with the channel name like

More than one package may be specified at once.  It is ok to mix these
four ways of specifying packages.

And the same command as implemented in Pyrus:

<?xml version="1.0" encoding="UTF-8"?>
<commands version="2.0" xmlns="">
  <summary>Install a package.  Use install --plugin to install plugins</summary>
    <doc>Manage plugin installation only</doc>
    <doc>Install the package in a directory in preparation for packaging with tools like RPM</doc>
    <doc>Automatically download and install all optional dependencies</doc>
    <doc>Force the installation to proceed independent of errors.  USE SPARINGLY.</doc>
    <doc>package.xml, local package archive, remove package archive, or abstract package.</doc>
  <doc>Installs listed packages.

local package.xml example:
php pyrus.phar install package.xml

local package archive example:
php pyrus.phar install PackageName-1.2.0.tar

remote package archive example:
php pyrus.phar install

Examples of an abstract package:
php pyrus.phar install PackageName
 installs PackageName from the default channel with stability preferred_state
php pyrus.phar pear/PackageName
 installs PackageName from the channel with stability preferred_state
php pyrus.phar install channel://
 installs PackageName from the channel with stability preferred_state
php pyrus.phar install PackageName-beta
 installs PackageName from the default channel, beta or stable stability
php pyrus.phar install PackageName-1.2.0
 installs PackageName from the default channel, version 1.2.0</doc>

The format for commands in Pyrus is much more fine-grained, and provides both better validation and better presentation of options and arguments as passed in from the user. In addition, Pyrus allows fine-grained specification of where a command is located, and automatically registers an autoloader to load the class implementing the command, and any dependent classes in the same location.

The details of new tags like <classprefix> and <autoloadpath> are documented in the full documentation of custom roles here.

This XML metadata file is identified by Pyrus through the use of the file role customcommand, which is used in the custom command's package.xml. Here is an example from the <contents> of a package.xml:

   <dir name="data">
    <file name="commands.xml" role="customcommand"/>
    <file name="someotherdata.csv" role="data"/>


フォーラムで「Pyrus Custom Commands: differences from PEAR」について話す
各種マニュアル: PHPマニュアル | PEARマニュアル | Smarty(英語)マニュアル | PHP-GTKマニュアル | Pyrus Custom Commands: differences from PEAR」をGoogle検索
copyright © 1997-2024 PHP ドキュメント作成グループ(ライセンス). provided by php spot. マニュアル: