Skip to content

Commit 45cd417

Browse files
committed
Add support for recipe file types
1 parent bebf7a5 commit 45cd417

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/Command/MainCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ protected function execute(Input $input, Output $output): int
9494
'project_hash' => empty($this->deployer->config['repository']) ? null : sha1($this->deployer->config['repository']),
9595
'hosts_count' => $this->deployer->hosts->count(),
9696
'recipes' => $this->deployer->config->get('recipes', []),
97+
'recipe_type' => $this->deployer->config->get('recipe_type', ''),
9798
]);
9899

99100
$hosts = $this->selectHosts($input, $output);

src/Command/RunCommand.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
class RunCommand extends SelectCommand
2828
{
29+
use CommandCommon;
2930
use CustomOption;
3031

3132
public function __construct(Deployer $deployer)
@@ -66,6 +67,7 @@ protected function execute(Input $input, Output $output): int
6667
{
6768
$this->deployer->input = $input;
6869
$this->deployer->output = $output;
70+
$this->telemetry();
6971

7072
$command = $input->getArgument('command-to-run') ?? '';
7173
$hosts = $this->selectHosts($input, $output);

src/Deployer.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,12 @@ public static function run(string $version, ?string $deployFile): void
269269

270270
// Import recipe file
271271
if (is_readable($deployFile ?? '')) {
272+
$deployer->config->set('recipe_type', match (pathinfo($deployFile, PATHINFO_EXTENSION)) {
273+
'php' => 'php',
274+
'maml' => 'maml',
275+
'yaml', 'yml' => 'yaml',
276+
default => 'unknown',
277+
});
272278
$deployer->importer->import($deployFile);
273279
}
274280

0 commit comments

Comments
 (0)