| 1 |
lars |
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.3.0 stable
|
|
|
15 |
*
|
|
|
16 |
* @package symfony
|
|
|
17 |
* @author Fabien Potencier <fabien.potencier@symfony-project.com>
|
|
|
18 |
* @version SVN: $Id: release.php 24079 2009-11-17 07:59:41Z Kris.Wallsmith $
|
|
|
19 |
*/
|
|
|
20 |
require_once(dirname(__FILE__).'/../../lib/exception/sfException.class.php');
|
|
|
21 |
require_once(dirname(__FILE__).'/../../lib/task/sfFilesystem.class.php');
|
|
|
22 |
require_once(dirname(__FILE__).'/../../lib/util/sfFinder.class.php');
|
|
|
23 |
require_once(dirname(__FILE__).'/../../lib/vendor/lime/lime.php');
|
|
|
24 |
|
|
|
25 |
if (!isset($argv[1]))
|
|
|
26 |
{
|
|
|
27 |
throw new Exception('You must provide version prefix.');
|
|
|
28 |
}
|
|
|
29 |
|
|
|
30 |
if (!isset($argv[2]))
|
|
|
31 |
{
|
|
|
32 |
throw new Exception('You must provide stability status (alpha/beta/stable).');
|
|
|
33 |
}
|
|
|
34 |
|
|
|
35 |
$stability = $argv[2];
|
|
|
36 |
|
|
|
37 |
$filesystem = new sfFilesystem();
|
|
|
38 |
|
|
|
39 |
if (($stability == 'beta' || $stability == 'alpha') && count(explode('.', $argv[1])) < 2)
|
|
|
40 |
{
|
|
|
41 |
$version_prefix = $argv[1];
|
|
|
42 |
|
|
|
43 |
list($result) = $filesystem->execute('svn status -u '.getcwd());
|
|
|
44 |
if (preg_match('/Status against revision\:\s+(\d+)\s*$/im', $result, $match))
|
|
|
45 |
{
|
|
|
46 |
$version = $match[1];
|
|
|
47 |
}
|
|
|
48 |
|
|
|
49 |
if (!isset($version))
|
|
|
50 |
{
|
|
|
51 |
throw new Exception('Unable to find last SVN revision.');
|
|
|
52 |
}
|
|
|
53 |
|
|
|
54 |
// make a PEAR compatible version
|
|
|
55 |
$version = $version_prefix.'.'.$version;
|
|
|
56 |
}
|
|
|
57 |
else
|
|
|
58 |
{
|
|
|
59 |
$version = $argv[1];
|
|
|
60 |
}
|
|
|
61 |
|
|
|
62 |
print sprintf("Releasing symfony version \"%s\".\n", $version);
|
|
|
63 |
|
|
|
64 |
// tests
|
|
|
65 |
list($result) = $filesystem->execute('php data/bin/symfony symfony:test');
|
|
|
66 |
|
|
|
67 |
if (0 != $result)
|
|
|
68 |
{
|
|
|
69 |
throw new Exception('Some tests failed. Release process aborted!');
|
|
|
70 |
}
|
|
|
71 |
|
|
|
72 |
if (is_file('package.xml'))
|
|
|
73 |
{
|
|
|
74 |
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
|
|
|
75 |
}
|
|
|
76 |
|
|
|
77 |
$filesystem->copy(getcwd().'/package.xml.tmpl', getcwd().'/package.xml');
|
|
|
78 |
|
|
|
79 |
// add class files
|
|
|
80 |
$finder = sfFinder::type('file')->relative();
|
|
|
81 |
$xml_classes = '';
|
|
|
82 |
$dirs = array('lib' => 'php', 'data' => 'data');
|
|
|
83 |
foreach ($dirs as $dir => $role)
|
|
|
84 |
{
|
|
|
85 |
$class_files = $finder->in($dir);
|
|
|
86 |
foreach ($class_files as $file)
|
|
|
87 |
{
|
|
|
88 |
$xml_classes .= '<file role="'.$role.'" baseinstalldir="symfony" install-as="'.$file.'" name="'.$dir.'/'.$file.'" />'."\n";
|
|
|
89 |
}
|
|
|
90 |
}
|
|
|
91 |
|
|
|
92 |
// replace tokens
|
|
|
93 |
$filesystem->replaceTokens(getcwd().DIRECTORY_SEPARATOR.'package.xml', '##', '##', array(
|
|
|
94 |
'SYMFONY_VERSION' => $version,
|
|
|
95 |
'CURRENT_DATE' => date('Y-m-d'),
|
|
|
96 |
'CLASS_FILES' => $xml_classes,
|
|
|
97 |
'STABILITY' => $stability,
|
|
|
98 |
));
|
|
|
99 |
|
|
|
100 |
list($results) = $filesystem->execute('pear package');
|
|
|
101 |
echo $results;
|
|
|
102 |
|
|
|
103 |
$filesystem->remove(getcwd().DIRECTORY_SEPARATOR.'package.xml');
|
|
|
104 |
|
|
|
105 |
exit(0);
|