Skip to content

Commit 71887a1

Browse files
authored
Merge pull request #173 from ByteInternet/add-hypernode-deploy-tree-command
Add 'tree' command to Hypernode Deploy to get overview and list of tasks for a stage
2 parents 3a39c68 + 3204696 commit 71887a1

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

src/Command/Tree.php

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

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)