コード例 #1
0
ファイル: package-generator.php プロジェクト: stof/pearweb
 /**
  * Retrieve a brand new package.xml based on the package info
  *
  * @return PEAR_PackageFile_v2_rw
  */
 function getBlankPackage()
 {
     require_once 'PEAR/Validate.php';
     include_once 'pear-database-package.php';
     $info = package::info($this->_package);
     $maintainers = package::info($this->_package, 'authors');
     $pf = new PEAR_PackageFile_v2_rw();
     $pf->setPackage($this->_package);
     $pf->setChannel('pear.php.net');
     $pf->setSummary($info['summary']);
     $pf->setDescription($info['description']);
     foreach ($maintainers as $maintainer) {
         $pf->addMaintainer($maintainer['role'], $maintainer['handle'], $maintainer['name'], $maintainer['email'], $maintainer['active'] ? 'yes' : 'no');
     }
     $pf->setReleaseVersion('0.1.0');
     $pf->setAPIVersion('0.1.0');
     $pf->setReleaseStability('alpha');
     $pf->setAPIStability('alpha');
     $pf->setPackageType('php');
     $licensemap = array('php' => 'http://www.php.net/license', 'php license' => 'http://www.php.net/license', 'lgpl' => 'http://www.gnu.org/copyleft/lesser.html', 'bsd' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd license' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd style' => 'http://www.opensource.org/licenses/bsd-license.php', 'bsd-style' => 'http://www.opensource.org/licenses/bsd-license.php', 'mit' => 'http://www.opensource.org/licenses/mit-license.php', 'gpl' => 'http://www.gnu.org/copyleft/gpl.html', 'apache' => 'http://www.opensource.org/licenses/apache2.0.php');
     if (isset($licensemap[strtolower($info['license'])])) {
         $uri = $licensemap[strtolower($info['license'])];
     } else {
         $uri = false;
     }
     $pf->setLicense($info['license'], $uri);
     $pf->clearContents();
     $pf->addFile('/', 'ADDFILESHERE', array('name' => 'ADDFILESHERE', 'role' => 'php'));
     $pf->setPhpDep('4.3.0');
     $pf->setPearinstallerDep('1.5.4');
     $pf->addRelease();
     return $pf;
 }