1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Sugarcrm\UpgradeSpec; |
4
|
|
|
|
5
|
|
|
use League\HTMLToMarkdown\HtmlConverter; |
6
|
|
|
use Sugarcrm\UpgradeSpec\Command\GenerateSpecCommand; |
7
|
|
|
use Sugarcrm\UpgradeSpec\Command\PharContext; |
8
|
|
|
use Sugarcrm\UpgradeSpec\Data\Manager; |
9
|
|
|
use Sugarcrm\UpgradeSpec\Data\Provider\LocalUpgradePackage; |
10
|
|
|
use Sugarcrm\UpgradeSpec\Data\Provider\SupportSugarcrm; |
11
|
|
|
use Sugarcrm\UpgradeSpec\Data\ProviderChain; |
12
|
|
|
use Sugarcrm\UpgradeSpec\Element\Generator as ElementGenerator; |
13
|
|
|
use Sugarcrm\UpgradeSpec\Element\Provider; |
14
|
|
|
use Sugarcrm\UpgradeSpec\Formatter\MarkdownFormatter; |
15
|
|
|
use Sugarcrm\UpgradeSpec\Helper\File; |
16
|
|
|
use Sugarcrm\UpgradeSpec\Helper\Sugarcrm; |
17
|
|
|
use Sugarcrm\UpgradeSpec\Spec\Generator; |
18
|
|
|
use Sugarcrm\UpgradeSpec\Template\TwigRenderer; |
19
|
|
|
use Symfony\Component\Console\Application as BaseApplication; |
20
|
|
|
use Symfony\Component\Console\Command\Command; |
21
|
|
|
use Twig_Loader_Filesystem; |
22
|
|
|
|
23
|
|
|
final class Application extends BaseApplication |
24
|
|
|
{ |
25
|
|
|
/** |
26
|
|
|
* Gets full version name. |
27
|
|
|
* |
28
|
|
|
* @return string |
29
|
|
|
*/ |
30
|
|
|
public function getLongVersion() |
31
|
|
|
{ |
32
|
|
|
$art = <<<EOL |
33
|
|
|
___ ___ ___ ___ ___ |
34
|
|
|
/__/\ / /\ / /\ / /\ / /\ |
35
|
|
|
\ \:\ / /:/_ / /::\ / /:/_ / /:/ |
36
|
|
|
\ \:\ / /:/ /\ / /:/\:\ / /:/ /\ / /:/ |
37
|
|
|
___ \ \:\ / /:/ /::\ / /:/~/:/ / /:/ /:/_ / /:/ ___ |
38
|
|
|
/__/\ \__\:\ /__/:/ /:/\:\ /__/:/ /:/ /__/:/ /:/ /\ /__/:/ / /\ |
39
|
|
|
\ \:\ / /:/ \ \:\/:/~/:/ \ \:\/:/ \ \:\/:/ /:/ \ \:\ / /:/ |
40
|
|
|
\ \:\ /:/ \ \::/ /:/ \ \::/ \ \::/ /:/ \ \:\ /:/ |
41
|
|
|
\ \:\/:/ \__\/ /:/ \ \:\ \ \:\/:/ \ \:\/:/ |
42
|
|
|
\ \::/ /__/:/ \ \:\ \ \::/ \ \::/ |
43
|
|
|
\__\/ \__\/ \__\/ \__\/ \__\/ |
44
|
|
|
EOL; |
45
|
|
|
|
46
|
|
|
return sprintf('<info>%s</info>', $art) . PHP_EOL . PHP_EOL . parent::getLongVersion() . ' by <comment>Mike Kamornikov</comment> and <comment>Denis Stiblo</comment>'; |
47
|
|
|
} |
48
|
|
|
|
49
|
|
|
public function add(Command $command) |
50
|
|
|
{ |
51
|
|
|
if (($command instanceof PharContext) && !$this->isPharContextAllowed()) { |
52
|
|
|
return null; |
53
|
|
|
} |
54
|
|
|
|
55
|
|
|
return parent::add($command); // TODO: Change the autogenerated stub |
|
|
|
|
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Defines if it's called from phar. |
60
|
|
|
* |
61
|
|
|
* @return bool |
62
|
|
|
*/ |
63
|
|
|
private function isPharContextAllowed() |
64
|
|
|
{ |
65
|
|
|
return \Phar::running() || (bool) getenv('DEV_MODE'); |
66
|
|
|
} |
67
|
|
|
} |
68
|
|
|
|