-
Notifications
You must be signed in to change notification settings - Fork 7
Update command #272
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
Merged
Merged
Update command #272
Changes from 11 commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
becb8b4
4565: Added update command
tuj d51484c
4565: Fixed issues raised by psalm
tuj 674bb1e
4565: Applied coding standards
tuj c80f097
4565: Cleaned up commands
tuj 81743ec
4565: Applied coding standards
tuj 4291977
Merge branch 'release/3.0.0' into feature/update-command
tuj d30349d
Merge branch 'release/3.0.0' into feature/update-command
tuj 1b611ed
4565: Fixed output from app:status command
tuj 4b8d66c
4565: Added update command documentation
tuj 6d68690
4565: Applied markdown styles
tuj a48f88e
4565: Fixed task
tuj f225a7d
4565: Changed Question to ConfirmationQuestion
tuj File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,9 +80,12 @@ To get started with the development setup, run the following task command: | |
|
||
```shell | ||
task site-install | ||
|
||
# or if you want to load fixtures as well | ||
task site-install-with-fixtures | ||
``` | ||
|
||
If you want to load fixtures, use the command (use the option `--yes` for auto-confirming). | ||
If you want to load fixtures manually, use the command (`--yes` for auto-confirming): | ||
|
||
```shell | ||
task fixtures:load --yes | ||
|
@@ -92,7 +95,7 @@ The fixtures have an admin user: <[email protected]> with the password: "apasswo | |
|
||
The fixtures have an editor user: <[email protected]> with the password: "apassword". | ||
|
||
The fixtures have the image-text template, and two screen layouts: full screen and "two boxes". | ||
The fixtures have the image-text template, and two screen layouts: "full screen" and "two boxes". | ||
|
||
## Production setup | ||
|
||
|
@@ -107,6 +110,12 @@ APP_SECRET=<GENERATE A NEW SECRET> | |
|
||
TODO: Add further production instructions: Build steps, release.json, etc. | ||
|
||
Use the `app:update` command to migrate and update templates to latest version: | ||
|
||
```shell | ||
docker compose exec phpfpm bin/console app:update --no-interaction | ||
``` | ||
|
||
## Coding standards | ||
|
||
Before a PR can be merged it has to pass the GitHub Actions checks. See `.github/workflows` for workflows that should | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Command; | ||
|
||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\ArrayInput; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
#[AsCommand( | ||
name: 'app:status', | ||
description: 'Returns current status of the application', | ||
)] | ||
class StatusCommand extends Command | ||
{ | ||
final protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
|
||
$application = $this->getApplication(); | ||
|
||
if (null === $application) { | ||
$io->error('Application not initialized.'); | ||
|
||
return Command::FAILURE; | ||
} | ||
|
||
$io->title('Migrations status'); | ||
|
||
// Check status for migrations. | ||
$command = new ArrayInput([ | ||
'command' => 'doctrine:migrations:up-to-date', | ||
]); | ||
$application->doRun($command, $output); | ||
|
||
$io->writeln(''); | ||
$io->writeln(''); | ||
$io->writeln(''); | ||
$io->title('Templates status'); | ||
|
||
// List status for templates. | ||
$command = new ArrayInput([ | ||
'command' => 'app:templates:list', | ||
'--status' => true, | ||
]); | ||
$application->doRun($command, $output); | ||
|
||
$io->info('Run app:update to update migrations and templates.'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Command; | ||
|
||
use App\Service\TemplateService; | ||
use Symfony\Component\Console\Attribute\AsCommand; | ||
use Symfony\Component\Console\Command\Command; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
use Symfony\Component\Console\Style\SymfonyStyle; | ||
|
||
#[AsCommand( | ||
name: 'app:templates:update', | ||
description: 'Update installed templates', | ||
)] | ||
class TemplatesUpdateCommand extends Command | ||
{ | ||
public function __construct( | ||
private readonly TemplateService $templateService, | ||
) { | ||
parent::__construct(); | ||
} | ||
|
||
final protected function execute(InputInterface $input, OutputInterface $output): int | ||
{ | ||
$io = new SymfonyStyle($input, $output); | ||
|
||
$templates = $this->templateService->getAllTemplates(); | ||
|
||
foreach ($templates as $templateToUpdate) { | ||
$this->templateService->updateTemplate($templateToUpdate); | ||
} | ||
|
||
$io->success('Updated all installed templates'); | ||
|
||
return Command::SUCCESS; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Symfony has a
ConfirmationQuestion
https://symfony.com/doc/current/components/console/helpers/questionhelper.html#asking-the-user-for-confirmation