Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TASK: Allow version 3 of consolidation/self-update #804

Merged
merged 2 commits into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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