Skip to content

Commit

Permalink
[TASK] Allow version 3 of consolidation/self-update (#804)
Browse files Browse the repository at this point in the history
  • Loading branch information
sabbelasichon authored and simonschaufi committed Feb 17, 2025
1 parent 9f2f027 commit fb52a99
Show file tree
Hide file tree
Showing 7 changed files with 36 additions and 2 deletions.
11 changes: 10 additions & 1 deletion bin/surf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
*/

use SelfUpdate\SelfUpdateCommand;
use SelfUpdate\SelfUpdateManager;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\Container;
use Symfony\Component\DependencyInjection\ContainerBuilder;
Expand All @@ -29,7 +30,15 @@ foreach ($commandNamesToHide as $commandNameToHide) {
$commandToHide = $application->get($commandNameToHide);
$commandToHide->setHidden(true);
}
$application->add(new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf'));

if (class_exists(SelfUpdateManager::class)) {
$selfUpdateManager = new SelfUpdateManager('TYPO3 Surf', $application->getVersion(), 'typo3/surf');
$selfUpdateCommand = new SelfUpdateCommand($selfUpdateManager);
} else {
$selfUpdateCommand = new SelfUpdateCommand('TYPO3 Surf', $application->getVersion(), 'typo3/surf');
}
$application->add($selfUpdateCommand);

$application->run();

function requireAutoloader()
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
},
"require": {
"php": "^7.4 || ^8.0",
"consolidation/self-update": "^2.1",
"consolidation/self-update": "^2.1 || ^3.0",
"guzzlehttp/guzzle": "^6.0 || ^7.0",
"monolog/monolog": "^2.9.1",
"myclabs/php-enum": "^1.8",
Expand Down
5 changes: 5 additions & 0 deletions src/Command/DeployCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ class DeployCommand extends Command
*/
protected static $defaultName = 'deploy';

public static function getDefaultName(): ?string
{
return 'deploy';
}

public function __construct(FactoryInterface $factory)
{
parent::__construct();
Expand Down
5 changes: 5 additions & 0 deletions src/Command/DescribeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ class DescribeCommand extends Command
*/
protected static $defaultName = 'describe';

public static function getDefaultName(): ?string
{
return 'describe';
}

public function __construct(FactoryInterface $factory)
{
parent::__construct();
Expand Down
5 changes: 5 additions & 0 deletions src/Command/RollbackCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory)
$this->factory = $factory;
}

public static function getDefaultName(): ?string
{
return 'rollback';
}

protected function configure(): void
{
$this->setDescription('Rollback current to previous release and remove current folder')
Expand Down
5 changes: 5 additions & 0 deletions src/Command/ShowCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ public function __construct(FactoryInterface $factory)
$this->factory = $factory;
}

public static function getDefaultName(): ?string
{
return 'show';
}

protected function configure(): void
{
$this->setDescription('Shows all the deployments depending on the directory configuration')
Expand Down
5 changes: 5 additions & 0 deletions src/Command/SimulateCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ public function __construct(FactoryInterface $factory)
$this->factory = $factory;
}

public static function getDefaultName(): ?string
{
return 'simulate';
}

protected function configure(): void
{
$this->setDescription('Simulates the deployment for the given name')
Expand Down

0 comments on commit fb52a99

Please sign in to comment.