Changeset 3261
- Timestamp:
- 01/13/07 15:19:56 (2 years ago)
- Files:
-
- trunk/data/bin/release.php (moved) (moved from trunk/pakefile.php) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/data/bin/release.php
r2871 r3261 3 3 /* 4 4 * This file is part of the symfony package. 5 * (c) 2004 , 2005Fabien Potencier <fabien.potencier@symfony-project.com>6 * 5 * (c) 2004-2007 Fabien Potencier <fabien.potencier@symfony-project.com> 6 * 7 7 * For the full copyright and license information, please view the LICENSE 8 8 * file that was distributed with this source code. … … 10 10 11 11 /** 12 * @package symfony 13 * @author Fabien Potencier <fabien.potencier@symfony-project.com> 14 * @version SVN: $Id$ 15 */ 16 17 /** 18 * Pakefile. 12 * Release script. 13 * 14 * Usage: php data/bin/release.php 1.0.0 stable 19 15 * 20 16 * @package symfony … … 22 18 * @version SVN: $Id$ 23 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'); 24 23 25 pake_import('pear'); 26 27 pake_desc('launch symfony test suite'); 28 pake_task('test'); 29 30 pake_desc('release a new symfony version'); 31 pake_task('release', 'test'); 32 33 function run_test($task, $args) 24 if (!isset($argv[1])) 34 25 { 35 require_once(dirname(__FILE__).'/lib/vendor/lime/lime.php'); 36 37 $h = new lime_harness(new lime_output_color()); 38 39 $h->base_dir = realpath(dirname(__FILE__).'/test'); 40 41 // unit tests 42 $h->register_glob($h->base_dir.'/unit/*/*Test.php'); 43 44 // functional tests 45 $h->register_glob($h->base_dir.'/functional/*Test.php'); 46 $h->register_glob($h->base_dir.'/functional/*/*Test.php'); 47 48 $h->run(); 26 throw new Exception('You must provide version prefix.'); 49 27 } 50 28 51 function run_create_pear_package($task, $args)29 if (!isset($argv[2])) 52 30 { 53 if (!isset($args[0])) 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)) 54 42 { 55 throw new Exception('you must provide pake version to release');43 $version = $match[1]; 56 44 } 57 45 58 $version = $args[0]; 59 $stability = $args[1]; 60 61 // create a pear package 62 print 'create pear package for version "'.$version."\"\n"; 63 64 try 46 if (!isset($version)) 65 47 { 66 @pake_remove('package.xml', getcwd()); 67 } 68 catch (Exception $e) 69 { 70 } 71 pake_copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml'); 72 73 // add class files 74 $finder = pakeFinder::type('file')->ignore_version_control()->relative(); 75 $xml_classes = ''; 76 $dirs = array('lib' => 'php', 'data' => 'data'); 77 foreach ($dirs as $dir => $role) 78 { 79 $class_files = $finder->in($dir); 80 foreach ($class_files as $file) 81 { 82 $xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n"; 83 } 48 throw new Exception('unable to find last svn revision'); 84 49 } 85 50 86 // replace tokens 87 pake_replace_tokens('package.xml', getcwd(), '##', '##', array( 88 'SYMFONY_VERSION' => $version, 89 'CURRENT_DATE' => date('Y-m-d'), 90 'CLASS_FILES' => $xml_classes, 91 'STABILITY' => $stability, 92 )); 93 pakePearTask::run_pear($task, $args); 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 { 94 82 pake_remove('package.xml', getcwd()); 95 83 } 96 84 97 function run_release($task, $args) 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) 98 92 { 99 if (!isset($args[0])) 93 $class_files = $finder->in($dir); 94 foreach ($class_files as $file) 100 95 { 101 throw new Exception('you must provide version prefix');96 $xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n"; 102 97 } 98 } 103 99 104 if (!isset($args[1])) 105 { 106 throw new Exception('you must provide stability status (alpha/beta/stable)'); 107 } 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 )); 108 107 109 $stability = $args[1]; 108 $results = pake_sh('pear package'); 109 echo $results; 110 110 111 if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $args[0])) < 2) 112 { 113 $version_prefix = $args[0]; 111 pake_remove('package.xml', getcwd()); 114 112 115 $result = pake_sh('svn status -u '.getcwd()); 116 if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match)) 117 { 118 $version = $match[1]; 119 } 113 // copy .tgz as symfony-latest.tgz 114 pake_copy(getcwd().'/symfony-'.$version.'.tgz', getcwd().'/symfony-latest.tgz'); 120 115 121 if (!isset($version)) 122 { 123 throw new Exception('unable to find last svn revision'); 124 } 125 126 // make a PEAR compatible version 127 $version = $version_prefix.'.'.$version; 128 } 129 else 130 { 131 $version = $args[0]; 132 } 133 134 if ($task->is_verbose()) 135 { 136 print 'releasing symfony version "'.$version."\"\n"; 137 } 138 139 $args[0] = $version; 140 141 run_create_pear_package($task, $args); 142 143 // copy .tgz as symfony-latest.tgz 144 pake_copy(getcwd().'/symfony-'.$version.'.tgz', getcwd().'/symfony-latest.tgz'); 145 } 116 exit(0);