From 4386914beddee6bb143c16272e6c11ee79ea0d9d Mon Sep 17 00:00:00 2001
From: Thomas Hauschild <7961978+Morgy93@users.noreply.github.com>
Date: Sat, 7 Dec 2024 11:03:28 +0100
Subject: [PATCH 1/9] add ListThemesCommand
---
CHANGELOG.md | 1 +
src/Console/Command/ListThemesCommand.php | 51 +++++++++++++++++++++++
src/Model/ThemeList.php | 19 +++++++++
src/etc/di.xml | 4 ++
4 files changed, 75 insertions(+)
create mode 100644 src/Console/Command/ListThemesCommand.php
create mode 100644 src/Model/ThemeList.php
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 799ec9b..8f667ab 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- changed Repository URLs
- added codacy code-quality badge to `README.md`
- moved to OpenForgeProject
+- add ListThemesCommand
---
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
new file mode 100644
index 0000000..c685c53
--- /dev/null
+++ b/src/Console/Command/ListThemesCommand.php
@@ -0,0 +1,51 @@
+setName('mageforge:themes:list');
+ $this->setDescription('Lists all available themes');
+ }
+
+ protected function execute(
+ InputInterface $input,
+ OutputInterface $output,
+ ): int {
+ $themes = $this->themeList->getAllThemes();
+
+ if (empty($themes)) {
+ $output->writeln('No themes found.');
+ return Cli::RETURN_SUCCESS;
+ }
+
+ $output->writeln('Available Themes:');
+ foreach ($themes as $path => $theme) {
+ $output->writeln(
+ sprintf(
+ '%s - %s',
+ $path,
+ $theme->getThemeTitle(),
+ ),
+ );
+ }
+
+ return Cli::RETURN_SUCCESS;
+ }
+}
diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php
new file mode 100644
index 0000000..73dea41
--- /dev/null
+++ b/src/Model/ThemeList.php
@@ -0,0 +1,19 @@
+magentoThemeList->getItems();
+ }
+}
diff --git a/src/etc/di.xml b/src/etc/di.xml
index 95d22e9..342417f 100644
--- a/src/etc/di.xml
+++ b/src/etc/di.xml
@@ -21,6 +21,10 @@
name="openforgeproject_mageforge_system_check"
xsi:type="object"
>OpenForgeProject\MageForge\Console\Command\SystemCheckCommand
+ - OpenForgeProject\MageForge\Console\Command\ListThemesCommand
From b11efe8124f814d00beb406b5a1dd083d3ed476e Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:12:55 +0100
Subject: [PATCH 2/9] Enhance ListThemesCommand and ThemeList with constructor
and method documentation
---
src/Console/Command/ListThemesCommand.php | 20 +++++++++++++++++---
src/Model/ThemeList.php | 15 +++++++++++++--
2 files changed, 30 insertions(+), 5 deletions(-)
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
index c685c53..eab0987 100644
--- a/src/Console/Command/ListThemesCommand.php
+++ b/src/Console/Command/ListThemesCommand.php
@@ -12,21 +12,35 @@
class ListThemesCommand extends Command
{
+ /**
+ * Constructor
+ *
+ * @param ThemeList $themeList
+ */
public function __construct(
private readonly ThemeList $themeList,
) {
parent::__construct();
}
- protected function configure(
- ): void {
+ /**
+ * Configure the command
+ */
+ protected function configure(): void {
$this->setName('mageforge:themes:list');
$this->setDescription('Lists all available themes');
}
+ /**
+ * Execute the command
+ *
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ * @return int
+ */
protected function execute(
InputInterface $input,
- OutputInterface $output,
+ OutputInterface $output
): int {
$themes = $this->themeList->getAllThemes();
diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php
index 73dea41..dd25e4c 100644
--- a/src/Model/ThemeList.php
+++ b/src/Model/ThemeList.php
@@ -8,10 +8,21 @@
class ThemeList
{
+ /**
+ * Constructor
+ *
+ * @param MagentoThemeList $magentoThemeList
+ */
public function __construct(
- private readonly MagentoThemeList $magentoThemeList,
- ) {}
+ private readonly MagentoThemeList $magentoThemeList
+ ) {
+ }
+ /**
+ * Get all themes
+ *
+ * @return array
+ */
public function getAllThemes(): array
{
return $this->magentoThemeList->getItems();
From 4f820f5dc78a2c9bf3256425c4c501e7d7b53002 Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Mon, 9 Dec 2024 21:28:01 +0100
Subject: [PATCH 3/9] Inject ProductMetadataInterface into SystemCheckCommand
and display Magento version in output
---
src/Console/Command/SystemCheckCommand.php | 10 ++++++++++
src/etc/di.xml | 4 ++++
2 files changed, 14 insertions(+)
diff --git a/src/Console/Command/SystemCheckCommand.php b/src/Console/Command/SystemCheckCommand.php
index 3357cc8..72fd9d0 100644
--- a/src/Console/Command/SystemCheckCommand.php
+++ b/src/Console/Command/SystemCheckCommand.php
@@ -15,7 +15,10 @@
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Magento\Framework\App\ProductMetadataInterface;
+<<<<<<< HEAD
use Magento\Framework\Escaper;
+=======
+>>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
class SystemCheckCommand extends Command
{
@@ -26,7 +29,10 @@ class SystemCheckCommand extends Command
*/
public function __construct(
private readonly ProductMetadataInterface $productMetadata,
+<<<<<<< HEAD
private readonly Escaper $escaper,
+=======
+>>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
) {
parent::__construct();
}
@@ -52,7 +58,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$mysqlVersion = $this->getShortMysqlVersion();
$osInfo = $this->getShortOsInfo();
$magentoVersion = $this->productMetadata->getVersion();
+<<<<<<< HEAD
$latestLtsNodeVersion = $this->escaper->escapeHtml($this->getLatestLtsNodeVersion());
+=======
+ $latestLtsNodeVersion = $this->getLatestLtsNodeVersion();
+>>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
$nodeVersionDisplay = Comparator::lessThan($nodeVersion, $latestLtsNodeVersion)
? "$nodeVersion> (Latest LTS: $latestLtsNodeVersion>)"
diff --git a/src/etc/di.xml b/src/etc/di.xml
index 342417f..97fdd9c 100644
--- a/src/etc/di.xml
+++ b/src/etc/di.xml
@@ -25,6 +25,10 @@
name="openforgeproject_mageforge_themes_list"
xsi:type="object"
>OpenForgeProject\MageForge\Console\Command\ListThemesCommand
+ - OpenForgeProject\MageForge\Console\Command\SystemCheckCommand
From f4c8641a6d489bd6db5f66cf6c1088fe7cda3903 Mon Sep 17 00:00:00 2001
From: Thomas Hauschild <7961978+Morgy93@users.noreply.github.com>
Date: Sat, 7 Dec 2024 11:03:28 +0100
Subject: [PATCH 4/9] add ListThemesCommand
---
src/Console/Command/ListThemesCommand.php | 14 ++++++++++++++
src/Model/ThemeList.php | 7 +++++++
2 files changed, 21 insertions(+)
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
index eab0987..489653e 100644
--- a/src/Console/Command/ListThemesCommand.php
+++ b/src/Console/Command/ListThemesCommand.php
@@ -12,25 +12,34 @@
class ListThemesCommand extends Command
{
+<<<<<<< HEAD
/**
* Constructor
*
* @param ThemeList $themeList
*/
+=======
+>>>>>>> 46cb511 (add ListThemesCommand)
public function __construct(
private readonly ThemeList $themeList,
) {
parent::__construct();
}
+<<<<<<< HEAD
/**
* Configure the command
*/
protected function configure(): void {
+=======
+ protected function configure(
+ ): void {
+>>>>>>> 46cb511 (add ListThemesCommand)
$this->setName('mageforge:themes:list');
$this->setDescription('Lists all available themes');
}
+<<<<<<< HEAD
/**
* Execute the command
*
@@ -41,6 +50,11 @@ protected function configure(): void {
protected function execute(
InputInterface $input,
OutputInterface $output
+=======
+ protected function execute(
+ InputInterface $input,
+ OutputInterface $output,
+>>>>>>> 46cb511 (add ListThemesCommand)
): int {
$themes = $this->themeList->getAllThemes();
diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php
index dd25e4c..84d70c2 100644
--- a/src/Model/ThemeList.php
+++ b/src/Model/ThemeList.php
@@ -8,6 +8,7 @@
class ThemeList
{
+<<<<<<< HEAD
/**
* Constructor
*
@@ -23,6 +24,12 @@ public function __construct(
*
* @return array
*/
+=======
+ public function __construct(
+ private readonly MagentoThemeList $magentoThemeList,
+ ) {}
+
+>>>>>>> 46cb511 (add ListThemesCommand)
public function getAllThemes(): array
{
return $this->magentoThemeList->getItems();
From afb38af29545e82d5fafe8cb1aff99b661632bb3 Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:22:00 +0100
Subject: [PATCH 5/9] Refactor ListThemesCommand: streamline constructor and
remove unnecessary comments
---
src/Console/Command/ListThemesCommand.php | 14 --------------
src/etc/di.xml | 4 ----
2 files changed, 18 deletions(-)
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
index 489653e..eab0987 100644
--- a/src/Console/Command/ListThemesCommand.php
+++ b/src/Console/Command/ListThemesCommand.php
@@ -12,34 +12,25 @@
class ListThemesCommand extends Command
{
-<<<<<<< HEAD
/**
* Constructor
*
* @param ThemeList $themeList
*/
-=======
->>>>>>> 46cb511 (add ListThemesCommand)
public function __construct(
private readonly ThemeList $themeList,
) {
parent::__construct();
}
-<<<<<<< HEAD
/**
* Configure the command
*/
protected function configure(): void {
-=======
- protected function configure(
- ): void {
->>>>>>> 46cb511 (add ListThemesCommand)
$this->setName('mageforge:themes:list');
$this->setDescription('Lists all available themes');
}
-<<<<<<< HEAD
/**
* Execute the command
*
@@ -50,11 +41,6 @@ protected function configure(
protected function execute(
InputInterface $input,
OutputInterface $output
-=======
- protected function execute(
- InputInterface $input,
- OutputInterface $output,
->>>>>>> 46cb511 (add ListThemesCommand)
): int {
$themes = $this->themeList->getAllThemes();
diff --git a/src/etc/di.xml b/src/etc/di.xml
index 97fdd9c..342417f 100644
--- a/src/etc/di.xml
+++ b/src/etc/di.xml
@@ -25,10 +25,6 @@
name="openforgeproject_mageforge_themes_list"
xsi:type="object"
>OpenForgeProject\MageForge\Console\Command\ListThemesCommand
- - OpenForgeProject\MageForge\Console\Command\SystemCheckCommand
From f51d3fd691ac7b63cbf7e943a4f1b81c53846926 Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:22:53 +0100
Subject: [PATCH 6/9] Clean up related code
---
src/Console/Command/SystemCheckCommand.php | 10 ----------
1 file changed, 10 deletions(-)
diff --git a/src/Console/Command/SystemCheckCommand.php b/src/Console/Command/SystemCheckCommand.php
index 72fd9d0..3357cc8 100644
--- a/src/Console/Command/SystemCheckCommand.php
+++ b/src/Console/Command/SystemCheckCommand.php
@@ -15,10 +15,7 @@
use Symfony\Component\Process\Process;
use Symfony\Component\Process\Exception\ProcessFailedException;
use Magento\Framework\App\ProductMetadataInterface;
-<<<<<<< HEAD
use Magento\Framework\Escaper;
-=======
->>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
class SystemCheckCommand extends Command
{
@@ -29,10 +26,7 @@ class SystemCheckCommand extends Command
*/
public function __construct(
private readonly ProductMetadataInterface $productMetadata,
-<<<<<<< HEAD
private readonly Escaper $escaper,
-=======
->>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
) {
parent::__construct();
}
@@ -58,11 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$mysqlVersion = $this->getShortMysqlVersion();
$osInfo = $this->getShortOsInfo();
$magentoVersion = $this->productMetadata->getVersion();
-<<<<<<< HEAD
$latestLtsNodeVersion = $this->escaper->escapeHtml($this->getLatestLtsNodeVersion());
-=======
- $latestLtsNodeVersion = $this->getLatestLtsNodeVersion();
->>>>>>> 53dd067 (Inject ProductMetadataInterface into SystemCheckCommand and display Magento version in output)
$nodeVersionDisplay = Comparator::lessThan($nodeVersion, $latestLtsNodeVersion)
? "$nodeVersion> (Latest LTS: $latestLtsNodeVersion>)"
From 14aa5616277d0566bc23283f49e0b6a6e576c43d Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:25:13 +0100
Subject: [PATCH 7/9] Remove unused constructor from ThemeList class
---
src/Model/ThemeList.php | 7 -------
1 file changed, 7 deletions(-)
diff --git a/src/Model/ThemeList.php b/src/Model/ThemeList.php
index 84d70c2..dd25e4c 100644
--- a/src/Model/ThemeList.php
+++ b/src/Model/ThemeList.php
@@ -8,7 +8,6 @@
class ThemeList
{
-<<<<<<< HEAD
/**
* Constructor
*
@@ -24,12 +23,6 @@ public function __construct(
*
* @return array
*/
-=======
- public function __construct(
- private readonly MagentoThemeList $magentoThemeList,
- ) {}
-
->>>>>>> 46cb511 (add ListThemesCommand)
public function getAllThemes(): array
{
return $this->magentoThemeList->getItems();
From 07c9c5cbdf78d8373f62de135b2b81ad824dd356 Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:29:39 +0100
Subject: [PATCH 8/9] Refactor ListThemesCommand: remove unused constructor and
improve code clarity
---
src/Console/Command/ListThemesCommand.php | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
index eab0987..872cbd6 100644
--- a/src/Console/Command/ListThemesCommand.php
+++ b/src/Console/Command/ListThemesCommand.php
@@ -12,35 +12,21 @@
class ListThemesCommand extends Command
{
- /**
- * Constructor
- *
- * @param ThemeList $themeList
- */
public function __construct(
private readonly ThemeList $themeList,
) {
parent::__construct();
}
- /**
- * Configure the command
- */
- protected function configure(): void {
+ protected function configure(): void
+ {
$this->setName('mageforge:themes:list');
$this->setDescription('Lists all available themes');
}
- /**
- * Execute the command
- *
- * @param InputInterface $input
- * @param OutputInterface $output
- * @return int
- */
protected function execute(
InputInterface $input,
- OutputInterface $output
+ OutputInterface $output,
): int {
$themes = $this->themeList->getAllThemes();
From caadb452d2ebd674425cf0650a13a6db1d07e045 Mon Sep 17 00:00:00 2001
From: Mathias Elle
Date: Fri, 13 Dec 2024 08:31:15 +0100
Subject: [PATCH 9/9] Enhance ListThemesCommand: add constructor documentation
and improve method comments
---
src/Console/Command/ListThemesCommand.php | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/src/Console/Command/ListThemesCommand.php b/src/Console/Command/ListThemesCommand.php
index 872cbd6..e01e6ad 100644
--- a/src/Console/Command/ListThemesCommand.php
+++ b/src/Console/Command/ListThemesCommand.php
@@ -12,18 +12,33 @@
class ListThemesCommand extends Command
{
+ /**
+ * Constructor
+ *
+ * @param ThemeList $themeList
+ */
public function __construct(
private readonly ThemeList $themeList,
) {
parent::__construct();
}
+ /**
+ * Configure the command
+ */
protected function configure(): void
{
$this->setName('mageforge:themes:list');
$this->setDescription('Lists all available themes');
}
+ /**
+ * Execute the command
+ *
+ * @param InputInterface $input
+ * @param OutputInterface $output
+ * @return int
+ */
protected function execute(
InputInterface $input,
OutputInterface $output,