|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Queryr\Replicator\Cli; |
|
4
|
|
|
|
|
5
|
|
|
use Queryr\Replicator\Cli\Command\ApiImportCommand; |
|
6
|
|
|
use Queryr\Replicator\Cli\Command\Bz2JsonImportCommand; |
|
7
|
|
|
use Queryr\Replicator\Cli\Command\GzJsonImportCommand; |
|
8
|
|
|
use Queryr\Replicator\Cli\Command\InstallCommand; |
|
9
|
|
|
use Queryr\Replicator\Cli\Command\JsonDumpImportCommand; |
|
10
|
|
|
use Queryr\Replicator\Cli\Command\RunTestsCommand; |
|
11
|
|
|
use Queryr\Replicator\Cli\Command\UninstallCommand; |
|
12
|
|
|
use Queryr\Replicator\Cli\Command\XmlDumpImportCommand; |
|
13
|
|
|
use Symfony\Component\Console\Application; |
|
14
|
|
|
|
|
15
|
|
|
/** |
|
16
|
|
|
* @licence GNU GPL v2+ |
|
17
|
|
|
* @author Jeroen De Dauw < [email protected] > |
|
18
|
|
|
*/ |
|
19
|
|
|
class ReplicatorCli { |
|
20
|
|
|
|
|
21
|
|
|
/** |
|
22
|
|
|
* @var Application |
|
23
|
|
|
*/ |
|
24
|
|
|
private $app; |
|
25
|
|
|
|
|
26
|
1 |
|
public function newApplication() :Application { |
|
27
|
1 |
|
$this->app = new Application(); |
|
28
|
|
|
|
|
29
|
1 |
|
$this->setApplicationInfo(); |
|
30
|
1 |
|
$this->registerCommands(); |
|
31
|
|
|
|
|
32
|
1 |
|
return $this->app; |
|
33
|
|
|
} |
|
34
|
|
|
|
|
35
|
1 |
|
private function setApplicationInfo() { |
|
36
|
1 |
|
$this->app->setName( 'Replicator' ); |
|
37
|
1 |
|
$this->app->setVersion( '0.2' ); |
|
38
|
1 |
|
} |
|
39
|
|
|
|
|
40
|
1 |
|
private function registerCommands() { |
|
41
|
1 |
|
$this->app->add( new InstallCommand() ); |
|
42
|
1 |
|
$this->app->add( new UninstallCommand() ); |
|
43
|
|
|
|
|
44
|
1 |
|
$this->app->add( new RunTestsCommand() ); |
|
45
|
|
|
|
|
46
|
1 |
|
$this->app->add( new XmlDumpImportCommand() ); |
|
47
|
1 |
|
$this->app->add( new ApiImportCommand() ); |
|
48
|
1 |
|
$this->app->add( new JsonDumpImportCommand() ); |
|
49
|
1 |
|
$this->app->add( new Bz2JsonImportCommand() ); |
|
50
|
1 |
|
$this->app->add( new GzJsonImportCommand() ); |
|
51
|
1 |
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function run() { |
|
54
|
|
|
$this->newApplication()->run(); |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
} |
|
58
|
|
|
|