|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* This file is part of the SVN-Buddy library. |
|
4
|
|
|
* For the full copyright and license information, please view |
|
5
|
|
|
* the LICENSE file that was distributed with this source code. |
|
6
|
|
|
* |
|
7
|
|
|
* @copyright Alexander Obuhovich <[email protected]> |
|
8
|
|
|
* @link https://github.com/console-helpers/svn-buddy |
|
9
|
|
|
*/ |
|
10
|
|
|
|
|
11
|
|
|
namespace ConsoleHelpers\SVNBuddy; |
|
12
|
|
|
|
|
13
|
|
|
|
|
14
|
|
|
use ConsoleHelpers\ConsoleKit\Application as BaseApplication; |
|
15
|
|
|
use ConsoleHelpers\ConsoleKit\Container as BaseContainer; |
|
16
|
|
|
use ConsoleHelpers\SVNBuddy\Command\AggregateCommand; |
|
17
|
|
|
use ConsoleHelpers\SVNBuddy\Command\CleanupCommand; |
|
18
|
|
|
use ConsoleHelpers\SVNBuddy\Command\CommitCommand; |
|
19
|
|
|
use ConsoleHelpers\SVNBuddy\Command\CompletionCommand; |
|
20
|
|
|
use ConsoleHelpers\SVNBuddy\Command\ConfigCommand; |
|
21
|
|
|
use ConsoleHelpers\SVNBuddy\Command\LogCommand; |
|
22
|
|
|
use ConsoleHelpers\SVNBuddy\Command\MergeCommand; |
|
23
|
|
|
use ConsoleHelpers\SVNBuddy\Command\MigrationCreateCommand; |
|
24
|
|
|
use ConsoleHelpers\SVNBuddy\Command\RevertCommand; |
|
25
|
|
|
use ConsoleHelpers\SVNBuddy\Command\UpdateCommand; |
|
26
|
|
|
use ConsoleHelpers\SVNBuddy\Repository\Connector\Connector; |
|
27
|
|
|
|
|
28
|
|
|
class Application extends BaseApplication |
|
29
|
|
|
{ |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* Creates application. |
|
33
|
|
|
* |
|
34
|
|
|
* @param BaseContainer $container Container. |
|
35
|
|
|
*/ |
|
36
|
|
|
public function __construct(BaseContainer $container) |
|
37
|
|
|
{ |
|
38
|
|
|
parent::__construct($container); |
|
39
|
|
|
|
|
40
|
|
|
$helper_set = $this->getHelperSet(); |
|
41
|
|
|
$helper_set->set($this->dic['date_helper']); |
|
42
|
|
|
$helper_set->set($this->dic['size_helper']); |
|
43
|
|
|
|
|
44
|
|
|
set_time_limit(0); |
|
45
|
|
|
ini_set('memory_limit', -1); |
|
46
|
|
|
|
|
47
|
|
|
putenv('LC_CTYPE=en_US.UTF-8'); // For SVN. |
|
48
|
|
|
} |
|
49
|
|
|
|
|
50
|
|
|
/** |
|
51
|
|
|
* Returns the long version of the application. |
|
52
|
|
|
* |
|
53
|
|
|
* @return string The long application version |
|
54
|
|
|
* |
|
55
|
|
|
* @api |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getLongVersion() |
|
58
|
|
|
{ |
|
59
|
|
|
$version = parent::getLongVersion(); |
|
60
|
|
|
|
|
61
|
|
|
/** @var Connector $repository_connector */ |
|
62
|
|
|
$repository_connector = $this->dic['repository_connector']; |
|
63
|
|
|
$client_version = $repository_connector->getCommand('', '--version --quiet')->run(); |
|
64
|
|
|
|
|
65
|
|
|
return $version . ' (SVN <comment>v' . trim($client_version) . '</comment>)'; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* {@inheritdoc} |
|
|
|
|
|
|
70
|
|
|
*/ |
|
|
|
|
|
|
71
|
|
|
protected function getDefaultCommands() |
|
72
|
|
|
{ |
|
73
|
|
|
$default_commands = parent::getDefaultCommands(); |
|
74
|
|
|
|
|
75
|
|
|
$default_commands[] = new MergeCommand(); |
|
76
|
|
|
// $default_commands[] = new ResolveCommand(); |
|
77
|
|
|
$default_commands[] = new CleanupCommand(); |
|
78
|
|
|
$default_commands[] = new RevertCommand(); |
|
79
|
|
|
$default_commands[] = new LogCommand(); |
|
80
|
|
|
$default_commands[] = new UpdateCommand(); |
|
81
|
|
|
$default_commands[] = new CommitCommand(); |
|
82
|
|
|
$default_commands[] = new AggregateCommand(); |
|
83
|
|
|
$default_commands[] = new CompletionCommand(); |
|
84
|
|
|
$default_commands[] = new ConfigCommand(); |
|
85
|
|
|
|
|
86
|
|
|
if ( !$this->isPharFile() ) { |
|
87
|
|
|
$default_commands[] = new MigrationCreateCommand(); |
|
88
|
|
|
} |
|
89
|
|
|
|
|
90
|
|
|
return $default_commands; |
|
|
|
|
|
|
91
|
|
|
} |
|
92
|
|
|
|
|
93
|
|
|
/** |
|
94
|
|
|
* Detects, when we're inside PHAR file. |
|
95
|
|
|
* |
|
96
|
|
|
* @return boolean |
|
97
|
|
|
*/ |
|
98
|
|
|
protected function isPharFile() |
|
99
|
|
|
{ |
|
100
|
|
|
return strpos(__DIR__, 'phar://') === 0; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
|
|
} |
|
104
|
|
|
|