Development

/trunk/pakefile.php

You must first sign up to be able to contribute.

root/trunk/pakefile.php

Revision 1, 3.2 kB (checked in by fabien, 9 years ago)

initial import

Line 
1 <?php
2
3 /*
4  * This file is part of the symfony package.
5  * (c) 2004, 2005 Fabien Potencier <fabien.potencier@gmail.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@gmail.com>
14  * @version    SVN: $Id$
15  */
16
17 /**
18  * Pakefile.
19  *
20  * @package    symfony
21  * @author     Fabien Potencier <fabien.potencier@gmail.com>
22  * @version    SVN: $Id$
23  */
24
25 pake_import('pear');
26
27 pake_desc('launch symfony test suite');
28 pake_task('alltests');
29
30 pake_desc('release a new symfony version');
31 pake_task('release', 'alltests');
32
33 function run_alltests($task, $args)
34 {
35   set_include_path(
36     dirname(__FILE__).PATH_SEPARATOR.
37     dirname(__FILE__).'/lib'.PATH_SEPARATOR.
38     get_include_path()
39   );
40
41   define('SF_LOGGING_ACTIVE', false);
42   require_once 'symfony/log/Log.class.php';
43   require_once 'symfony/log/sfLogger.class.php';
44
45   pake_import('simpletest', false);
46   pakeSimpletestTask::call_simpletest($task, 'text');
47 }
48
49 function run_create_pear_package($task, $args)
50 {
51   if (!$args[0])
52   {
53     throw new Exception('you must provide pake version to release');
54   }
55
56   $version    = $args[0];
57   $stability  = $args[1];
58
59   // create a pear package
60   print 'create pear package for version "'.$version."\"\n";
61
62   try
63   {
64     @pake_remove('package.xml', getcwd());
65   }
66   catch (Exception $e)
67   {
68   }
69   pake_copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
70
71   // add class files
72   $finder = pakeFinder::type('file')->prune('.svn')->discard('.svn')->relative();
73   $xml_classes = '';
74   $dirs = array('lib' => 'php', 'data/symfony' => 'data');
75   foreach ($dirs as $dir => $role)
76   {
77     $class_files = $finder->in($dir);
78     foreach ($class_files as $file)
79     {
80       $xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
81     }
82   }
83
84   // replace tokens
85   pake_replace_tokens('package.xml', getcwd(), '##', '##', array(
86     'SYMFONY_VERSION' => $version,
87     'CURRENT_DATE'    => date('Y-m-d'),
88     'CLASS_FILES'     => $xml_classes,
89     'STABILITY'       => $stability,
90   ));
91   pakePearTask::run_pear($task, $args);
92   pake_remove('package.xml', getcwd());
93 }
94
95 function run_release($task, $args)
96 {
97   if (!$args[0])
98   {
99     throw new Exception('you must provide version prefix (0.5 for beta release or 0.6.0 for stable release)');
100   }
101
102   if (!$args[1])
103   {
104     throw new Exception('you must provide stability status (alpha/beta/stable)');
105   }
106
107   $stability = $args[1];
108
109   if ($stability == 'beta')
110   {
111     $version_prefix = $args[0];
112
113     $result = pake_sh('svn status -u '.getcwd());
114
115     if (preg_match('/Status against revision\:\s*(\d+)/is', $result, $match))
116     {
117       $version = $match[1];
118     }
119
120     if (!$version)
121     {
122       throw new Exception('unable to find last svn revision');
123     }
124
125     // make a PEAR compatible version
126     $version = $version_prefix.'.'.$version;
127   }
128   else
129   {
130     $version = $args[0];
131   }
132
133   if ($task->is_verbose()) print 'releasing symfony version "'.$version."\"\n";
134
135   $args[0] = $version;
136
137   run_create_pear_package($task, $args);
138
139   // copy .tgz as symfony-latest.tgz
140   pake_copy(getcwd().'/symfony-'.$version.'.tgz', getcwd().'/symfony-latest.tgz');
141 }
142
143 ?>
Note: See TracBrowser for help on using the browser.