Skip to content

Commit

Permalink
[TASK] Simplify command name configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon committed Mar 12, 2020
1 parent 3af719d commit 7f3cc77
Show file tree
Hide file tree
Showing 9 changed files with 61 additions and 94 deletions.

This file was deleted.

This file was deleted.

21 changes: 15 additions & 6 deletions src/Cli/Symfony/ConsoleKernel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

namespace TYPO3\Surf\Cli\Symfony;

Expand All @@ -12,11 +12,14 @@
*/

use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\HttpKernel\Kernel;
use TYPO3\Surf\Cli\Symfony\CompilerPasses\CommandsToApplicationCompilerPass;
use TYPO3\Surf\Cli\Symfony\CompilerPasses\ContainerAwareInterfaceCompilerPass;
use TYPO3\Surf\Cli\Symfony\CompilerPasses\ShellCommandServiceAwareInterfaceCompilerPass;
use TYPO3\Surf\Domain\Service\ShellCommandService;
use TYPO3\Surf\Domain\Service\ShellCommandServiceAwareInterface;

final class ConsoleKernel extends Kernel
{
Expand All @@ -33,7 +36,7 @@ public function registerBundles()
*/
public function registerContainerConfiguration(LoaderInterface $loader): void
{
$loader->load(__DIR__ . '/../../../Resources/services.yaml');
$loader->load(__DIR__.'/../../../Resources/services.yaml');
}

/**
Expand All @@ -42,7 +45,13 @@ public function registerContainerConfiguration(LoaderInterface $loader): void
protected function build(ContainerBuilder $containerBuilder): void
{
$containerBuilder->addCompilerPass(new CommandsToApplicationCompilerPass());
$containerBuilder->addCompilerPass(new ContainerAwareInterfaceCompilerPass());
$containerBuilder->addCompilerPass(new ShellCommandServiceAwareInterfaceCompilerPass());
$containerBuilder->registerForAutoconfiguration(
ContainerAwareInterface::class)->addMethodCall(
'setContainer', [new Reference(ContainerInterface::class)]
);
$containerBuilder->registerForAutoconfiguration(
ShellCommandServiceAwareInterface::class)->addMethodCall(
'setShellCommandService', [new Reference(ShellCommandService::class)]
);
}
}
12 changes: 8 additions & 4 deletions src/Command/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class DeployCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'deploy';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('deploy')
->setDescription('Deploys the application with the given name')
$this->setDescription('Deploys the application with the given name')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/DescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,20 @@ class DescribeCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'describe';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure()
{
$this->setName('describe')
->setDescription('Describes the flow for the given name')
$this->setDescription('Describes the flow for the given name')
->addArgument(
'deploymentName',
InputArgument::REQUIRED,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/RollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class RollbackCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'rollback';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('rollback')
->setDescription('Rollback current to previous release and remove current folder')
$this->setDescription('Rollback current to previous release and remove current folder')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down
8 changes: 6 additions & 2 deletions src/Command/SelfUpdateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@

class SelfUpdateCommand extends Command
{
/**
* @var string
*/
protected static $defaultName = 'self-update';

public function isEnabled(): bool
{
return Phar::running() !== '';
}

protected function configure(): void
{
$this->setName('self-update')
->addOption(
$this->addOption(
'stability',
null,
InputOption::VALUE_OPTIONAL,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,20 @@ class ShowCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'show';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('show')
->setDescription('Shows all the deployments depending on the directory configuration')
$this->setDescription('Shows all the deployments depending on the directory configuration')
->addOption(
'configurationPath',
null,
Expand Down
12 changes: 8 additions & 4 deletions src/Command/SimulateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,20 @@ class SimulateCommand extends Command
*/
private $factory;

public function __construct(FactoryInterface $factory, string $name = null)
/**
* @var string
*/
protected static $defaultName = 'simulate';

public function __construct(FactoryInterface $factory)
{
parent::__construct($name);
parent::__construct();
$this->factory = $factory;
}

protected function configure(): void
{
$this->setName('simulate')
->setDescription('Simulates the deployment for the given name')
$this->setDescription('Simulates the deployment for the given name')
->addArgument(
'deploymentName',
InputArgument::OPTIONAL,
Expand Down

0 comments on commit 7f3cc77

Please sign in to comment.