前言
以下的文章是從pear官方網站所擷取下來的(應該是沒有版權問題吧 ^^")
是大爺的學習筆記
所以如果翻譯有什麼地方有錯誤,請告知大爺,感恩哩 ^^
Pyrus defines three kinds of plugins: commands, file roles, and file tasks. Commands add new commands to a frontend for Pyrus, file roles and file tasks add new features to package.xml.
(pyrus定義三種外掛:命令,檔案規則和檔案任務。命令增加新的命令用於pyrus前端,檔案規則和檔案任務則增加新的特色到package.xml。)
Pyrus, by necessity, requires a clear separation between its plugins and its core. This is because Pyrus is distributed as a phar archive, which cannot be modified without jumping through several hoops. For this reason, plugins are installed in a special directory whose location is specified by the plugins_dir user configuration variable.
(藉由必需,pyrus要求一個明確分開外掛和核心。這是因為pyrus是分散式的當作一個phar檔案,無法被更改在沒有任何的jumping透過幾個hoops。因為理由,外掛是被安裝在一個特別的目錄,這個目錄是被plugins_dir使用者設定變數所定義。)
Pyrus also makes a clear separation between regular packages and plugin packages. Plugins must be installed separate from any non-plugin packages using the --plugin option of the install, upgrade, and uninstall command. Here is an example, installing the developer tools plugin:
(pyrus 也作一個清楚的分別在規則套件和外掛套件之間。套件必須被安裝分開從任何的non-plugin套件使使用--plugin安裝、更新和反安裝的選項命令。這裡是一個範例,安裝發展工具的外掛:
php pyrus.phar install -p PEAR2_Pyrus_Developer
Pyrus defines a plugin as any package that contains one of the three file roles that identify a plugin: customcommand, customrole, or customtask. In addition, a plugin package can only contain one plugin. This helps users by mapping one package to one plugin so that when they list plugin packages, it clearly shows all of the plugins that are installed.
(pyrus定義一個外掛當作任何的套件包含定義一個外掛的三個檔案規則中的一個:customcommad,customrole規則、或customtask。此外,一個外掛套件只能夠包含一個外掛。這是幫助使用者藉由映射一個套件到一個外掛,所以當他們列出外掛套件時,它能夠清楚的顯示所有被安裝的外掛。)
A plugin's definition is handled by an XML file, which must be referenced using one of the three plugin file roles in package.xml. Here is an example identifying a custom command in package.xml:
(一個外掛的定義檔是經由一個XML檔案來處理,必須被參照使用在package.xml檔案中的三個外掛檔案規則的一個。這裡是一個範例定義一個自定命令在package.xml:)
...
<dir name="/">
<dir name="customcommand" baseinstalldir="/">
<file role="customcommand" name="commands.xml"/>
</dir>
...