[ Index ]
 

Code source de Symfony 1.0.0

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/data/bin/ -> release.php (source)

   1  <?php
   2  
   3  /*
   4   * This file is part of the symfony package.
   5   * (c) 2004-2007 Fabien Potencier <fabien.potencier@symfony-project.com>
   6   * 
   7   * For the full copyright and license information, please view the LICENSE
   8   * file that was distributed with this source code.
   9   */
  10  
  11  /**
  12   * Release script.
  13   *
  14   * Usage: php data/bin/release.php 1.0.0 stable
  15   *
  16   * @package    symfony
  17   * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
  18   * @version    SVN: $Id$
  19   */
  20  require_once(dirname(__FILE__).'/../../lib/vendor/pake/pakeFunction.php');
  21  require_once(dirname(__FILE__).'/../../lib/vendor/pake/pakeGetopt.class.php');
  22  require_once(dirname(__FILE__).'/../../lib/vendor/lime/lime.php');
  23  
  24  if (!isset($argv[1]))
  25  {
  26    throw new Exception('You must provide version prefix.');
  27  }
  28  
  29  if (!isset($argv[2]))
  30  {
  31    throw new Exception('You must provide stability status (alpha/beta/stable).');
  32  }
  33  
  34  $stability = $argv[2];
  35  
  36  if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2)
  37  {
  38    $version_prefix = $argv[1];
  39  
  40    $result = pake_sh('svn status -u '.getcwd());
  41    if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match))
  42    {
  43      $version = $match[1];
  44    }
  45  
  46    if (!isset($version))
  47    {
  48      throw new Exception('unable to find last svn revision');
  49    }
  50  
  51    // make a PEAR compatible version
  52    $version = $version_prefix.'.'.$version;
  53  }
  54  else
  55  {
  56    $version = $argv[1];
  57  }
  58  
  59  print 'releasing symfony version "'.$version."\"\n";
  60  
  61  // Test
  62  $h = new lime_harness(new lime_output_color());
  63  
  64  $h->base_dir = realpath(dirname(__FILE__).'/../../test');
  65  
  66  // unit tests
  67  $h->register_glob($h->base_dir.'/unit/*/*Test.php');
  68  
  69  // functional tests
  70  $h->register_glob($h->base_dir.'/functional/*Test.php');
  71  $h->register_glob($h->base_dir.'/functional/*/*Test.php');
  72  
  73  $ret = $h->run();
  74  
  75  if (!$ret)
  76  {
  77    throw new Exception('Some tests failed. Release process aborted!');
  78  }
  79  
  80  if (is_file('package.xml'))
  81  {
  82    pake_remove('package.xml', getcwd());
  83  }
  84  
  85  pake_copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
  86  
  87  // add class files
  88  $finder = pakeFinder::type('file')->ignore_version_control()->relative();
  89  $xml_classes = '';
  90  $dirs = array('lib' => 'php', 'data' => 'data');
  91  foreach ($dirs as $dir => $role)
  92  {
  93    $class_files = $finder->in($dir);
  94    foreach ($class_files as $file)
  95    {
  96      $xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
  97    }
  98  }
  99  
 100  // replace tokens
 101  pake_replace_tokens('package.xml', getcwd(), '##', '##', array(
 102    'SYMFONY_VERSION' => $version,
 103    'CURRENT_DATE'    => date('Y-m-d'),
 104    'CLASS_FILES'     => $xml_classes,
 105    'STABILITY'       => $stability,
 106  ));
 107  
 108  $results = pake_sh('pear package');
 109  echo $results;
 110  
 111  pake_remove('package.xml', getcwd());
 112  
 113  // copy .tgz as symfony-latest.tgz
 114  pake_copy(getcwd().'/symfony-'.$version.'.tgz', getcwd().'/symfony-latest.tgz');
 115  
 116  exit(0);


Généré le : Fri Mar 16 22:42:14 2007 par Balluche grâce à PHPXref 0.7