Development

/tags/RELEASE_1_0_0_beta1/pakefile.php

You must first sign up to be able to contribute.

root/tags/RELEASE_1_0_0_beta1/pakefile.php

Revision 2871, 3.3 kB (checked in by fabien, 2 years ago)

updated pakefile for symfony release

Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004, 2005 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  * @package    symfony
13  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
14  * @version    SVN: $Id$
15  */
16
17 /**
18  * Pakefile.
19  *
20  * @package    symfony
21  * @author     Fabien Potencier <fabien.potencier@symfony-project.com>
22  * @version    SVN: $Id$
23  */
24
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)
34 {
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();
49 }
50
51 function run_create_pear_package($task, $args)
52 {
53   if (!isset($args[0]))
54   {
55     throw new Exception('you must provide pake version to release');
56   }
57
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
65   {
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     }
84   }
85
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);
94   pake_remove('package.xml', getcwd());
95 }
96
97 function run_release($task, $args)
98 {
99   if (!isset($args[0]))
100   {
101     throw new Exception('you must provide version prefix');
102   }
103
104   if (!isset($args[1]))
105   {
106     throw new Exception('you must provide stability status (alpha/beta/stable)');
107   }
108
109   $stability = $args[1];
110
111   if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $args[0])) < 2)
112   {
113     $version_prefix = $args[0];
114
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     }
120
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 }
146
Note: See TracBrowser for help on using the browser.