|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
// +---------------------------------------------------------------------------+ |
|
4
|
|
|
// | This file is part of the Agavi package. | |
|
5
|
|
|
// | Copyright (c) 2005-2011 the Agavi Project. | |
|
6
|
|
|
// | | |
|
7
|
|
|
// | For the full copyright and license information, please view the LICENSE | |
|
8
|
|
|
// | file that was distributed with this source code. You can also view the | |
|
9
|
|
|
// | LICENSE file online at http://www.agavi.org/LICENSE.txt | |
|
10
|
|
|
// | vi: set noexpandtab: | |
|
11
|
|
|
// | Local Variables: | |
|
12
|
|
|
// | indent-tabs-mode: t | |
|
13
|
|
|
// | End: | |
|
14
|
|
|
// +---------------------------------------------------------------------------+ |
|
15
|
|
|
|
|
16
|
|
|
class VersionTask extends Task |
|
|
|
|
|
|
17
|
|
|
{ |
|
18
|
|
|
public function main() |
|
19
|
|
|
{ |
|
20
|
|
|
$agaviPath = realpath(getcwd() . '/src/agavi.php'); |
|
21
|
|
|
|
|
22
|
|
|
if (!$agaviPath && !file_exists($agaviPath)) { |
|
23
|
|
|
throw new BuildException('Agavi not found.'); |
|
24
|
|
|
} |
|
25
|
|
|
|
|
26
|
|
|
require_once($agaviPath); |
|
27
|
|
|
|
|
28
|
|
|
$this->project->setUserProperty('agavi.version', Config::get('agavi.version')); |
|
29
|
|
|
$this->project->setUserProperty('agavi.pear.version', sprintf("%d.%d.%d%s", |
|
30
|
|
|
Config::get('agavi.major_version'), |
|
31
|
|
|
Config::get('agavi.minor_version'), |
|
32
|
|
|
Config::get('agavi.micro_version'), |
|
33
|
|
|
Config::has('agavi.status') ? Config::get('agavi.status') : '' |
|
34
|
|
|
)); |
|
35
|
|
|
|
|
36
|
|
|
$status = Config::get('agavi.status'); |
|
37
|
|
|
|
|
38
|
|
|
if ($status == 'dev') { |
|
39
|
|
|
$status = 'devel'; |
|
40
|
|
|
} elseif (strpos($status, 'alpha') !== false) { |
|
41
|
|
|
$status = 'alpha'; |
|
42
|
|
|
} elseif (strpos($status, 'beta') !== false) { |
|
43
|
|
|
$status = 'beta'; |
|
44
|
|
|
} elseif (strpos($status, 'RC') !== false) { |
|
45
|
|
|
$status = 'beta'; |
|
46
|
|
|
} else { |
|
47
|
|
|
$status = 'stable'; |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
$this->project->setUserProperty('agavi.status', $status); |
|
51
|
|
|
} |
|
52
|
|
|
} |
|
53
|
|
|
|
You can fix this by adding a namespace to your class:
When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.