1 | <?php |
||
11 | class DownloadDnsDock extends InstallerTask implements DependentChainProcessInterface |
||
12 | { |
||
13 | /** |
||
14 | * @var UserInteraction |
||
15 | */ |
||
16 | private $userInteraction; |
||
17 | |||
18 | /** |
||
19 | * @var ProcessRunner |
||
20 | */ |
||
21 | private $processRunner; |
||
22 | |||
23 | /** |
||
24 | * @var DockerMachineCli |
||
25 | */ |
||
26 | private $machine; |
||
27 | |||
28 | /** |
||
29 | * @param UserInteraction $userInteraction |
||
30 | * @param ProcessRunner $processRunner |
||
31 | * @param DockerMachineCli $machine |
||
32 | */ |
||
33 | public function __construct(UserInteraction $userInteraction, ProcessRunner $processRunner, DockerMachineCli $machine) |
||
34 | { |
||
35 | $this->userInteraction = $userInteraction; |
||
36 | $this->processRunner = $processRunner; |
||
37 | $this->machine = $machine; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * {@inheritdoc} |
||
42 | */ |
||
43 | public function run() |
||
44 | { |
||
45 | $this->userInteraction->writeTitle("Pulling image aacebedo/dnsdock"); |
||
46 | $this->userInteraction->write("Check docker machine is running"); |
||
47 | if (!$this->machine->isRunning()) { |
||
48 | $this->userInteraction->write("Starting machine"); |
||
49 | $this->machine->start(); |
||
50 | } |
||
51 | $this->userInteraction->write("Setting environment variables"); |
||
52 | $this->processRunner->run($this->machine->getEnvironmentDeclaration()); |
||
53 | |||
54 | $this->userInteraction->write("Pulling image aacebedo/dnsdock, this could take a while when run for the first time"); |
||
55 | $this->processRunner->run('docker pull aacebedo/dnsdock:latest-amd64'); |
||
56 | } |
||
57 | |||
58 | /** |
||
59 | * {@inheritdoc} |
||
60 | */ |
||
61 | public function dependsOn() |
||
65 | |||
66 | /** |
||
67 | * {@inheritdoc} |
||
68 | */ |
||
69 | public function getName() |
||
73 | } |
||
74 |