本文整理汇总了PHP中PEAR_PackageFileManager2::addGlobalReplacement方法的典型用法代码示例。如果您正苦于以下问题:PHP PEAR_PackageFileManager2::addGlobalReplacement方法的具体用法?PHP PEAR_PackageFileManager2::addGlobalReplacement怎么用?PHP PEAR_PackageFileManager2::addGlobalReplacement使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PEAR_PackageFileManager2
的用法示例。
在下文中一共展示了PEAR_PackageFileManager2::addGlobalReplacement方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: License
$package->setPackage('Piece_Unity_Component_ContentLength');
$package->setPackageType('php');
$package->setSummary('An output filter which sends a Content-Legnth header. This filter must be added first.');
$package->setDescription('An output filter which sends a Content-Legnth header. This filter must be added first.');
$package->setChannel('pear.piece-framework.com');
$package->setLicense('BSD License (revised)', 'http://www.opensource.org/licenses/bsd-license.php');
$package->setAPIVersion($apiVersion);
$package->setAPIStability($apiStability);
$package->setReleaseVersion($releaseVersion);
$package->setReleaseStability($releaseStability);
$package->setNotes($notes);
$package->setPhpDep('4.3.0');
$package->setPearinstallerDep('1.4.3');
$package->addPackageDepWithChannel('required', 'Piece_Unity', 'pear.piece-framework.com', '1.0.0');
$package->addMaintainer('lead', 'iteman', 'KUBO Atsuhiro', 'iteman@users.sourceforge.net');
$package->addGlobalReplacement('package-info', '@package_version@', 'version');
$package->generateContents();
if (array_key_exists(1, $_SERVER['argv']) && $_SERVER['argv'][1] == 'make') {
$package->writePackageFile();
} else {
$package->debugPackageFile();
}
exit;
/*
* Local Variables:
* mode: php
* coding: iso-8859-1
* tab-width: 4
* c-basic-offset: 4
* c-hanging-comment-ender-p: nil
* indent-tabs-mode: nil
示例2: main
/**
* Main entry point for d51pearpkg2 task
*/
public function main()
{
$package = new PEAR_PackageFileManager2();
$this->_initOptions();
$package->setOptions($this->_options);
$package->setPackage($this->_name->__toString());
$package->setSummary($this->_summary->__toString());
$desc = preg_replace("/^({$this->_description->indention_type}{{$this->_description->indentions_to_remove}}|\t)+/m", '', $this->_description->__toString());
$package->setDescription($desc);
$package->setChannel($this->_channel->__toString());
$package->setAPIVersion($this->_version->api);
$package->setReleaseVersion($this->_version->release);
$package->setAPIStability($this->_stability->api);
$package->setReleaseStability($this->_stability->release);
// TODO: allow different types
$package->setPackageType('php');
$package->addRelease();
if ($this->_dependencies->php !== false) {
$package->setPhpDep($this->_dependencies->php->minimum_version);
} else {
$package->setPhpDep(phpversion());
}
if ($this->_dependencies->pear !== false) {
$package->setPearinstallerDep($this->_dependencies->pear->minimum_version, $this->_dependencies->pear->maximum_version, $this->_dependencies->pear->recommended_version, $this->_dependencies->pear->exclude_version);
} else {
$package->setPearinstallerDep(PEAR_Config::singleton()->getRegistry()->packageInfo('PEAR', 'version'));
}
foreach ($this->_maintainers as $maintainer) {
$package->addMaintainer($maintainer->role, $maintainer->user, $maintainer->name, $maintainer->email, $maintainer->active);
}
// handle dependencies
if (!empty($this->_dependencies)) {
$this->log('adding dependencies');
if (count($this->_dependencies->groups) > 0) {
$this->log('found dependency groups');
foreach ($this->_dependencies->groups as $group) {
$this->log("adding [{$group->name}] :: [{$group->hint}]");
$package->addDependencyGroup($group->name, $group->hint);
foreach ($group->packages as $sub_package) {
$package->addGroupPackageDepWithChannel('subpackage', $group->name, $sub_package->name, $sub_package->channel, '0.0.1');
}
}
}
if (count($this->_dependencies->packages) > 0) {
$this->log('found dependencies');
foreach ($this->_dependencies->packages as $dependency) {
$this->log("adding following dependency: {$dependency->channel}/{$dependency->name}");
$package->addPackageDepWithChannel($dependency->type, $dependency->name, $dependency->channel, $dependency->minimum_version, $dependency->maximum_version, $dependency->recommended_version, $dependency->exclude_version, $dependency->providesextension, $dependency->nodefault);
}
}
if (count($this->_dependencies->extensions) > 0) {
$this->log('adding extension dependencies');
foreach ($this->_dependencies->extensions as $extension) {
$this->log("adding ext dependency for: {$extension->name}");
$package->addExtensionDep($extension->type, $extension->name, $extension->minimum_version, $extension->maximum_version, $extension->recommended_version, $extension->extension);
}
}
}
foreach ($this->_changelogs as $changelog) {
$this->log("adding changelog for prior release [{$changelog->version}]");
$changelog->package = $package;
$package->setChangelogEntry($changelog->version, $changelog->toArray());
if (is_null($this->_notes) && $package->getVersion() == $changelog->version) {
$this->log("no package notes specified, using changelog entry");
$this->_notes = $changelog->contents;
}
}
foreach ($this->_replacements as $replacement) {
$replacement->isValid();
$package->addReplacement($replacement->path, $replacement->type, $replacement->from, $replacement->to);
}
foreach ($this->_globalreplacements as $replacement) {
$replacement->isValid();
$this->log("adding global repalcement: {$replacement->from}");
$package->addGlobalReplacement($replacement->type, $replacement->from, $replacement->to);
}
foreach ($this->_releases as $release) {
$this->log('adding new release');
$package->addRelease();
foreach ($release->install as $install) {
$this->log("installing [{$install->name}] as [{$install->as}]");
$package->addInstallAs($install->name, $install->as);
}
}
$notes = preg_replace("/^( {4}|\t)+/m", '', $this->_notes->__toString());
$package->setNotes($notes);
$package->setLicense($this->_license->license, $this->_license->uri);
// handle PostInstallation
if (!empty($this->_postinstalls)) {
foreach ($this->_postinstalls as $postInstall) {
$postInstallScript = $package->initPostinstallScript($postInstall->script);
$this->log('adding post installation for script : ' . $postInstall->script);
foreach ($postInstall->paramgroups as $paramGroup) {
$this->log('adding parameter group' . $paramGroup->name);
$instructions = $paramGroup->instructions;
if (empty($instructions)) {
$instructions = false;
//.........这里部分代码省略.........
示例3:
$pfm->addIgnoreToRelease('bin/git-xref-lint');
$pfm->addInstallAs('bin/xref-lint.bat', 'xref-lint.bat');
$pfm->addInstallAs('bin/xref-doc.bat', 'xref-doc.bat');
// other platforms
$pfm->addRelease();
$pfm->addIgnoreToRelease('bin/xref-lint.bat');
$pfm->addIgnoreToRelease('bin/xref-doc.bat');
$pfm->addInstallAs('bin/xref-lint', 'xref-lint');
$pfm->addInstallAs('bin/xref-doc', 'xref-doc');
$pfm->addInstallAs('bin/xref-ci', 'xref-ci');
$pfm->addInstallAs('bin/git-xref-lint', 'git-xref-lint');
$pfm->setPhpDep('5.2.0');
$pfm->setPearinstallerDep('1.4.0a12');
$pfm->addMaintainer('lead', 'gariev', 'Igor Gariev', 'gariev@hotmail.com');
$pfm->setLicense('PHP License', 'http://www.php.net/license');
$pfm->addGlobalReplacement('package-info', '@version@', 'version');
$pfm->addGlobalReplacement('pear-config', '@php_bin@', 'php_bin');
// path to php executable
$pfm->addGlobalReplacement('pear-config', '@bin_dir@', 'bin_dir');
// bin dir
$pfm->addGlobalReplacement('pear-config', '@php_dir@', 'php_dir');
// lib dir
$pfm->addGlobalReplacement('pear-config', '@data_dir@', 'data_dir');
// data dir ()
$pfm->addGlobalReplacement('pear-config', '@doc_dir@', 'doc_dir');
// data dir ()
$pfm->generateContents();
// remove 'baseinstalldir' from scripts
$filelist = $pfm->getFilelist();
foreach ($filelist as $filename => $attrs) {
if ($attrs['role'] == 'script') {
示例4:
$packagexml->setPackage($config['package']);
$packagexml->setChannel($config['channel']);
$packagexml->setReleaseVersion($config['release_ver']);
$packagexml->setAPIVersion($config['api_ver']);
$packagexml->setReleaseStability($config['stability']);
$packagexml->setAPIStability($config['stability']);
$packagexml->setSummary($config['summery']);
$packagexml->setDescription($config['description']);
$packagexml->setNotes($config['note']);
$packagexml->setPhpDep($config['dep_php']);
$packagexml->setPearinstallerDep($config['pear_ver']);
$packagexml->addMaintainer('lead', 'koriyama', 'Koriyama', 'koriyama@users.sourceforge.jp');
$packagexml->setLicense('The BSD License', 'http://www.opensource.org/licenses/bsd-license.php');
$packagexml->addRole('sh', 'script');
$packagexml->addRole('conf', 'php');
$packagexml->addRole('yml', 'php');
$packagexml->addRole('css', 'php');
$packagexml->addGlobalReplacement('pear-config', '@PEAR-DIR@', 'php_dir');
$packagexml->addGlobalReplacement('pear-config', '@DATA-DIR@', 'data_dir');
$packagexml->addGlobalReplacement('pear-config', '@PHP-BIN@', 'bin_dir');
$packagexml->generateContents();
//$pkg = &$packagexml->exportCompatiblePackageFile1();
if (isset($_GET['make']) || isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make') {
// $pkg->writePackageFile();
$packagexml->writePackageFile();
// $packagexml->debugPackageFile();
} else {
// $pkg->debugPackageFile();
// $packagexml->writePackageFile();
$packagexml->debugPackageFile();
}
示例5: dirname
require_once 'PEAR/PackageFileManager2.php';
// recommended - makes PEAR_Errors act like exceptions (kind of)
PEAR::setErrorHandling(PEAR_ERROR_DIE);
$packagexml = new PEAR_PackageFileManager2();
$packagexml->setOptions(array('filelistgenerator' => 'file', 'packagedirectory' => dirname(__FILE__) . "/src", 'baseinstalldir' => 'PEAR', 'simpleoutput' => true));
$packagexml->setPackageType('php');
$packagexml->addRelease();
$packagexml->setPackage('ChainRecord');
$packagexml->setChannel('__uri');
$packagexml->setReleaseVersion('0.1.0');
$packagexml->setAPIVersion('0.1.0');
$packagexml->setReleaseStability('alpha');
$packagexml->setAPIStability('alpha');
$packagexml->setSummary('Object-Relation Mapper for php with Method Chain.');
$packagexml->setDescription('Database Access Library for php 5.2.x');
$packagexml->setNotes('Initial release');
$packagexml->setPhpDep('5.2.0');
$packagexml->setPearinstallerDep('1.4.0a12');
$packagexml->addPackageDepWithChannel('required', 'PEAR_PackageFileManager', 'pear.php.net', '1.5.1');
$packagexml->addMaintainer('lead', 'hirakiuc', 'Daisuke Hirakiuchi', 'hirakiuc@gmail.com');
$packagexml->setLicense('MIT License', 'http://www.opensource.org/licenses/mit-license.php');
$packagexml->addGlobalReplacement('package-info', '@PEAR-VER@', 'version');
$packagexml->generateContents();
//$pkg = &$packagexml->exportCompatiblePackageFile1();
if (isset($_GET['make']) || isset($_SERVER['argv']) && @$_SERVER['argv'][1] == 'make') {
// $pkg->writePackageFile();
$packagexml->writePackageFile();
} else {
// $pkg->debugPackageFile();
$packagexml->debugPackageFile();
}
示例6:
$packagexml->setPackageType('php');
// this is a PEAR-style php script package
// Depends on PHP 5
$packagexml->setPhpDep('5.1.2');
// Depends on Pear 1.4.0 or greater
$packagexml->setPearinstallerDep('1.4.0');
// Depends on these PEAR packages
# added these to when you create a new app into the vendor folder
#$packagexml->addPackageDepWithChannel('required', 'MDB2', 'pear.php.net', '2.0');
#$packagexml->addPackageDepWithChannel('required', 'Mail', 'pear.php.net', '1.0');
#$packagexml->addPackageDepWithChannel('required', 'Mail_Mime', 'pear.php.net', '1.0');
// Who maintains this package
$packagexml->addMaintainer('lead', 'john', 'John Peterson', 'johnpipi@gmail.com');
$packagexml->addMaintainer('developer', 'haas', 'Walt Haas', 'haas@xmission.com');
// Substitute local configuration values for these symbols
$packagexml->addGlobalReplacement('pear-config', '@BIN-DIR@', 'bin_dir');
$packagexml->addGlobalReplacement('pear-config', '@DOC-DIR@', 'doc_dir');
$packagexml->addGlobalReplacement('pear-config', '@PHP-DIR@', 'php_dir');
$packagexml->addGlobalReplacement('pear-config', '@DATA-DIR@', 'data_dir');
$packagexml->addGlobalReplacement('pear-config', '@PHP-BIN@', 'php_bin');
$packagexml->addGlobalReplacement('pear-config', '@TEST-DIR@', 'test_dir');
// Platform-dependent command lines
$packagexml->addRelease();
// set up a release section
$packagexml->setOSInstallCondition('windows');
$packagexml->addInstallAs('pear-trax.bat', 'trax');
$packagexml->addIgnoreToRelease('pear-trax');
$packagexml->addRelease();
// add another release section for all other OSes
$packagexml->addInstallAs('pear-trax', 'trax');
$packagexml->addIgnoreToRelease('pear-trax.bat');