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: 18ade19a1b7a57f3c5b025d1adb9d9fd6cf033aa $
  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. require_once dirname(__FILE__'/../Ethna.php';
  42.  
  43. $version_array explode('.'ETHNA_VERSION);
  44. $major_version implode('.'array_slice($version_array02));
  45. $minor_version implode(''array_slice(explode('-'$version_array[2])01));
  46.  
  47. if ($state == 'alpha' || $state == 'beta'{
  48.     $version $major_version "." $minor_version $state strftime('%Y%m%d%H');
  49. else {
  50.     $version $major_version "." $minor_version;
  51. }
  52.  
  53. if ($get_version{
  54.     print $version;
  55.     exit();
  56. }
  57.  
  58. $config array(
  59.     'baseinstalldir' => 'Ethna',
  60.     'packagedirectory' => dirname(dirname(__FILE__)),
  61.     'filelistgenerator' => 'file',
  62.     'ignore' => array(
  63.         'CVS/''.svn/''package.xml''ethna_make_package.php''ethna_make_package.sh''*optional_package*''coverage/',
  64.         '.gitignore''.gitattributes',
  65.     ),
  66.     'changelogoldtonew' => false,
  67.     'exceptions' => array('README' => 'doc''LICENSE' => 'doc''CHANGES' => 'doc',),
  68.     'description' => $description,
  69.     'exceptions' => array('bin/ethna.sh' => 'script''bin/ethna.bat' => 'script'),
  70.     'installexceptions' => array('bin/ethna.sh' => '/''bin/ethna.bat' => '/'),
  71.     'installas' => array('bin/ethna.sh' => 'ethna''bin/ethna.bat' => 'ethna.bat'),
  72. );
  73.  
  74. $ethna_channel 'pear.ethna.jp';
  75. $packagexml new PEAR_PackageFileManager2();
  76. $packagexml->setOptions($config);
  77. $packagexml->setPackage($package);
  78. $packagexml->setSummary('Ethna PHP Framework Package');
  79. $packagexml->setDescription($description);
  80. $packagexml->setChannel($ethna_channel);
  81. $packagexml->setAPIVersion($version);
  82. $packagexml->setReleaseVersion($version);
  83. $packagexml->setReleaseStability($state);
  84. $packagexml->setAPIStability($state);
  85. $packagexml->setNotes('Ethna PHP Web Application Framework');
  86. $packagexml->setPackageType('php');
  87.  
  88. $packagexml->addRole('*''php');
  89.  
  90. $packagexml->setPhpDep('5.2.0');
  91. $packagexml->setPearinstallerDep('1.9.0');
  92. $packagexml->addPackageDepWithChannel('optional''DB''pear.php.net');
  93. $packagexml->addPackageDepWithChannel('optional''Smarty'$ethna_channel);
  94. $packagexml->addPackageDepWithChannel('optional''simpletest'$ethna_channel);
  95. $packagexml->addPackageDepWithChannel('optional''Smarty3'$ethna_channel);
  96.  
  97. $packagexml->addMaintainer('lead''sotarok' 'Sotaro Karasawa''sotaro.k@gmail.com');
  98.  
  99. $packagexml->setLicense('The BSD License''http://www.opensource.org/licenses/bsd-license.php');
  100.  
  101. $packagexml->addReplacement('bin/ethna.bat''pear-config''@PEAR-DIR@''php_dir');
  102. $packagexml->addReplacement('bin/ethna.bat''pear-config''@PHP-BIN@''bin_dir');
  103. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PHP-BINARY@''php_bin');
  104. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PEAR-DIR@''php_dir');
  105. $packagexml->addReplacement('bin/ethna.sh''pear-config''@PHP-BIN@''bin_dir');
  106.  
  107. $packagexml->addRelease();
  108. $packagexml->setOSInstallCondition('windows');
  109. $packagexml->addInstallAs('bin/ethna.bat''ethna.bat');
  110. $packagexml->addIgnoreToRelease('bin/ethna.sh');
  111. $packagexml->addRelease();
  112. $packagexml->addInstallAs('bin/ethna.sh''ethna');
  113. $packagexml->addIgnoreToRelease('bin/ethna.bat');
  114.  
  115. $packagexml->generateContents();
  116.  
  117. if ($is_old_package{
  118.     if (method_exists($packagexml'exportCompatiblePackageFile1')) {
  119.         $pkg =$packagexml->exportCompatiblePackageFile1();
  120.         $pkg->writePackageFile();
  121.     else {
  122.         //  PEAR package version 1 is not supported over PEAR 1.8.0.
  123.         echo "WARNING: PEAR package version 1 is not supported in this PEAR version.\n";
  124.     }
  125. else {
  126.     $packagexml->writePackageFile();
  127. }

Documentation generated on Fri, 11 Nov 2011 03:58:06 +0900 by phpDocumentor 1.4.3