Skip to content

Commit 7bfbaaa

Browse files
author
Jonathan Visser
committed
Add 'tree' command to Hypernode Deploy to get overview and list of tasks for a stage
1 parent 3a39c68 commit 7bfbaaa

File tree

2 files changed

+41
-1
lines changed

2 files changed

+41
-1
lines changed

src/Command/Tree.php

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
3+
namespace Hypernode\Deploy\Command;
4+
5+
use Deployer\Deployer;
6+
use Deployer\Command\TreeCommand;
7+
use Symfony\Component\Console\Input\InputInterface as Input;
8+
use Symfony\Component\Console\Output\OutputInterface as Output;
9+
use Hypernode\Deploy\DeployRunner;
10+
use Hypernode\Deploy\Exception\InvalidConfigurationException;
11+
use Hypernode\Deploy\Exception\ValidationException;
12+
13+
class Tree extends TreeCommand
14+
{
15+
/**
16+
* @var DeployRunner
17+
*/
18+
private $deployRunner;
19+
20+
public function __construct(
21+
Deployer $deployer,
22+
DeployRunner $deployRunner,
23+
) {
24+
parent::__construct($deployer);
25+
$this->deployRunner = $deployRunner;
26+
}
27+
28+
protected function execute(Input $input, Output $output): int
29+
{
30+
try {
31+
$this->deployRunner->prepare(true, true, $input->getArgument('task'), false);
32+
} catch (InvalidConfigurationException | ValidationException $e) {
33+
$output->write($e->getMessage());
34+
return 1;
35+
}
36+
$result = parent::execute($input, $output);
37+
38+
return $result;
39+
}
40+
}

src/DeployRunner.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public function run(
104104
* @throws InvalidConfigurationException
105105
* @throws Throwable
106106
*/
107-
private function prepare(
107+
public function prepare(
108108
bool $configureBuildStage,
109109
bool $configureServers,
110110
string $stage,

0 commit comments

Comments
 (0)