Source for file ethna_make_package.php

Documentation is available at ethna_make_package.php

  1. <?php
  2. /**
  3.  *  ethna_make_package.php
  4.  *
  5.  *  package.xml generator for Ethna
  6.  *
  7.  *  @license    http://www.opensource.org/licenses/bsd-license.php The BSD License
  8.  *  @package    Ethna
  9.  *  @version    $Id$
  10.  */
  11. require_once 'PEAR.php';
  12. require_once 'Console/Getopt.php';
  13. require_once 'PEAR/PackageFileManager2.php';
  14. require_once 'PEAR/PackageFileManager/File.php';   // avoid bugs
  15.  
  16. // args
  17. $arg_list Console_Getopt::readPHPArgv();
  18. $state "stable";
  19. $is_old_package false;
  20. $get_version false;
  21.  
  22. $r Console_Getopt::getopt($arg_list"abov"array("alpha""beta""old-package""version"));
  23. foreach ($r[0as $opt{
  24.     if ($opt[0== "a" || $opt[0== "--alpha"{
  25.         $state "alpha";
  26.     }
  27.     if ($opt[0== "b" || $opt[0== "--beta"{
  28.         $state "beta";
  29.     }
  30.     if ($opt[0== "o" || $opt[0== "--old-package"{
  31.         $is_old_package true;
  32.     }
  33.     if ($opt[0== "v" || $opt[0== "--version"{
  34.         $get_version true;
  35.     }
  36. }
  37.  
  38. $description 'Ethna Web Application Framework';
  39. $package 'Ethna';
  40.  
  41. // x.0.y -> beta
  42. // x.1.y -> stable
  43. $major_version "2.5";
  44. $minor_version "0";
  45.  
  46. if ($state == 'alpha' || $state == 'beta'{
  47.     $version $major_version strftime('.%Y%m%d%H');
  48. else {
  49.     $version $major_version "." $minor_version;
  50. }
  51.  
  52. if ($get_version{
  53.     print $version;
  54.     exit();
  55. }
  56.  
  57. $config array(
  58.     'baseinstalldir' => 'Ethna',
  59.     'packagedirectory' => dirname(dirname(__FILE__)),
  60.     'filelistgenerator' => 'file',
  61.     'ignore' => array('CVS/''.svn/''package.xml''ethna_make_package.php''ethna_make_package.sh''*optional_package*'),
  62.     'changelogoldtonew' => false,
  63.     'exceptions' => array('README' => 'doc''LICENSE' => 'doc''CHANGES' => 'doc',),
  64.     'description' => $description,
  65.     'exceptions' => array('bin/ethna.sh' => 'script''bin/ethna.bat' => 'script'),
  66.     'installexceptions' => array('bin/ethna.sh' => '/''bin/ethna.bat' => '/'),
  67.     'installas' => array('bin/ethna.sh' => 'ethna''bin/ethna.bat' => 'ethna.bat'),
  68. );
  69.  
  70. $ethna_channel 'pear.ethna.jp';
  71. $packagexml new PEAR_PackageFileManager2();
  72. $packagexml->setOptions($config);
  73. $packagexml->setPackage($package);
  74. $packagexml->setSummary('Ethna PHP Framework Package');
  75. $packagexml->setDescription($description);
  76. $packagexml->setChannel($ethna_channel);
  77. $packagexml->setAPIVersion($version);
  78. $packagexml->setReleaseVersion($version);
  79. $packagexml->setReleaseStability($state);
  80. $packagexml->setAPIStability($state);
  81. $packagexml->setNotes('Ethna PHP Web Application Framework');
  82. $packagexml->setPackageType('php');
  83.  
  84. $packagexml->addRole('*''php');
  85.  
  86. $packagexml->setPhpDep('4.1.0');
  87. $packagexml->setPearinstallerDep('1.3.5');
  88. $packagexml->addPackageDepWithChannel('optional''DB''pear.php.net');
  89. $packagexml->addPackageDepWithChannel('optional''Smarty'$ethna_channel);
  90. $packagexml->addPackageDepWithChannel('optional''simpletest'$ethna_channel);
  91.  
  92. $packagexml->addMaintainer('lead''fujimoto' 'Masaki Fujimoto''fujimoto@php.net');
  93. $packagexml->addMaintainer('lead''halt' 'halt feits''halt.feits@gmail.com');
  94. $packagexml->addMaintainer('lead''cocoitiban''Keita Arai''cocoiti@comio.info');
  95. $packagexml->addMaintainer('lead''ichii386''ICHII Takashi''ichii386@schweetheart.jp');
  96.  
  97. $packagexml->setLicense('The BSD License''http://www.opensource.org/licenses/bsd-license.php');
  98.  
  99. $packagexml->addReplacement('bin/ethna.bat''pear-config''@PEAR-DIR@''php_dir');
  100. $packagexml->addReplacement('bin/ethna.bat''pear-config''@PHP-BIN@''bin_dir');
  101. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PHP-BINARY@''php_bin');
  102. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PEAR-DIR@''php_dir');
  103. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PHP-BIN@''bin_dir');
  104.  
  105. $packagexml->addRelease();
  106. $packagexml->setOSInstallCondition('windows');
  107. $packagexml->addInstallAs('bin/ethna.bat''ethna.bat');
  108. $packagexml->addIgnoreToRelease('bin/ethna.sh');
  109. $packagexml->addRelease();
  110. $packagexml->addInstallAs('bin/ethna.sh''ethna');
  111. $packagexml->addIgnoreToRelease('bin/ethna.bat');
  112.  
  113. $packagexml->generateContents();
  114.  
  115. if ($is_old_package{
  116.     if (method_exists($packagexml'exportCompatiblePackageFile1')) {
  117.         $pkg =$packagexml->exportCompatiblePackageFile1();
  118.         $pkg->writePackageFile();
  119.     else {
  120.         //  PEAR package version 1 is not supported over PEAR 1.8.0.
  121.         echo "WARNING: PEAR package version 1 is not supported in this PEAR version.\n";
  122.     }
  123. else {
  124.     $packagexml->writePackageFile();
  125. }
  126. ?>

Documentation generated on Fri, 11 Nov 2011 03:59:56 +0900 by phpDocumentor 1.4.3