home *** CD-ROM | disk | FTP | other *** search
/ Cricao de Sites - 650 Layouts Prontos / WebMasters.iso / Servidores / xampp-win32-1.6.7-installer.exe / php / PEAR / tools / package_gen.php < prev   
Encoding:
PHP Script  |  2008-07-02  |  4.4 KB  |  124 lines

  1. #!/usr/bin/php -q
  2. <?php
  3. /* vim: set noai expandtab tabstop=4 softtabstop=4 shiftwidth=4: */
  4. /**
  5.  * Script to generate package.xml file
  6.  *
  7.  * Parts taken from Limb PHP Framework http://limb-project.com 
  8.  * More info 
  9.  *  http://www.developertutorials.com/pear-manual/developers.packagedef.html
  10.  *  http://blog.astrumfutura.com/plugin/blogpdf
  11.  *  http://trac.piece-framework.com/piece-unity/browser/trunk/package.php?rev=887
  12.  * 
  13.  * PHP version 5
  14.  * 
  15.  * @category  System
  16.  * @package   System_Daemon
  17.  * @author    Kevin <kevin@vanzonneveld.net>
  18.  * @copyright 2008 Kevin van Zonneveld (http://kevin.vanzonneveld.net)
  19.  * @license   http://www.opensource.org/licenses/bsd-license.php New BSD Licence
  20.  * @version   SVN: Release: $Id$
  21.  * @link      http://trac.plutonia.nl/projects/system_daemon
  22.  */
  23.  
  24. $workspace_dir = realpath(dirname(__FILE__)."/..");
  25.  
  26. list($name, $baseVersion, $state) = explode("-", 
  27.     trim(file_get_contents($workspace_dir . "/docs/VERSION")));
  28.     
  29. $notes       = htmlspecialchars(file_get_contents($workspace_dir . 
  30.     "/docs/NOTES"));
  31. $summary     = htmlspecialchars(file_get_contents($workspace_dir . 
  32.     "/docs/SUMMARY"));
  33. $description = htmlspecialchars(file_get_contents($workspace_dir . 
  34.     "/docs/DESCRIPTION"));
  35. $maintainers = file($workspace_dir . "/docs/MAINTAINERS");
  36.  
  37. $version = $baseVersion . (isset($argv[3]) ? $argv[3] : "");
  38. $dir     = $workspace_dir;
  39.  
  40. $apiVersion   = $baseVersion;
  41. $apiStability = $state;
  42.  
  43. require_once "PEAR/PackageFileManager2.php";
  44. PEAR::setErrorHandling(PEAR_ERROR_DIE);
  45.  
  46. $options = array(
  47.     "package"           => $name,
  48.     "summary"           => $summary,
  49.     "version"           => $version,
  50.     "state"             => $state,
  51.     "description"       => $description,
  52.     "notes"             => $notes,
  53.     "filelistgenerator" => "svn",
  54.     "ignore"            => array(   "package2.php",
  55.                                     "package.xml",
  56.                                     "*.tgz",
  57.                                     ".svn",
  58.                                     ".project",
  59.                                     "docs",
  60.                                     "tools"
  61.                             ),
  62.     "simpleoutput"      => true,
  63.     "clearcontents"     => true,
  64.     "baseinstalldir"    => "./",
  65.     "packagedirectory"  => $workspace_dir,
  66.     "packagefile"       => "package.xml",
  67.     "dir_roles"         => array(
  68.                                 "docs" => "doc",
  69.                                 "examples" => "doc",
  70.                                 "tests" => "test",
  71.                                 "data" => "data"
  72.                             ),
  73.     "roles"             => array(
  74.                                 "*" => "php"
  75.                             )
  76. );
  77.  
  78.  
  79. $packagexml = new PEAR_PackageFileManager2;
  80. $e          = $packagexml->setOptions($options);
  81.  
  82. // Oddly enough, this is a PHP source code package...
  83. $packagexml->setPackageType("php");
  84. // Package name, summary and longer description
  85. $packagexml->setPackage($name);
  86. $packagexml->setSummary($summary);
  87. $packagexml->setDescription($description);
  88. // The channel where this package is hosted. Since we"re installing from a local
  89. // downloaded file rather than a channel we"ll pretend it"s from PEAR.
  90. $packagexml->setChannel("pear.php.net");
  91.  
  92. foreach ($maintainers as $line) {
  93.     list($role, $nick, $name, $email, $active) = explode(",", $line);
  94.     $packagexml->addMaintainer($role, $nick, $name, $email, $active);
  95. }
  96.  
  97. $packagexml->setNotes($notes);
  98. // Add any known dependencies such as PHP version, extensions, PEAR installer
  99. $packagexml->setPhpDep("5.1.2"); // spl_autoload_register
  100. $packagexml->setPearinstallerDep("1.4.0");
  101. $packagexml->setOSInstallCondition("(*ix|*ux|darwin*|*BSD|SunOS*)");
  102. $packagexml->addPackageDepWithChannel("optional", "Log", "pear.php.net", "1.0"); 
  103.  
  104. // Other info, like the Lead Developers. license, version details 
  105. // and stability type
  106. $packagexml->setLicense("New BSD License", 
  107.     "http://opensource.org/licenses/bsd-license.php");
  108. $packagexml->setAPIVersion($baseVersion);
  109. $packagexml->setAPIStability($state);
  110. $packagexml->setReleaseVersion($baseVersion);
  111. $packagexml->setReleaseStability($state);
  112. // Add this as a release, and generate XML content
  113. $packagexml->addRelease();
  114.  
  115. $packagexml->generateContents();
  116.  
  117. if (isset($_GET["make"]) 
  118.     || (isset($_SERVER["argv"]) 
  119.     && @$_SERVER["argv"][1] == "make")) {
  120.     $packagexml->writePackageFile();
  121. } else {
  122.     $packagexml->debugPackageFile();
  123. }
  124. ?>