From 6f6e58a7dc21a9a5580d8232b4424b9ab1c5938e Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 31 Jul 2022 17:21:20 +0200 Subject: [PATCH 1/4] Link to the test --- .../framework/src/Commands/HydeRebuildStaticSiteCommand.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php index 98b339a0f71..dcb853d09c3 100644 --- a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php +++ b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php @@ -11,6 +11,8 @@ /** * Hyde Command to build a single static site file. + * + * @see \Hyde\Framework\Testing\Feature\Commands\HydeRebuildStaticSiteCommandTest */ class HydeRebuildStaticSiteCommand extends Command { From adfe4e2921fced3312ebd0805e93a46613c52edf Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 31 Jul 2022 17:23:48 +0200 Subject: [PATCH 2/4] Use the BuildService to transfer media asssets --- .../framework/src/Commands/HydeRebuildStaticSiteCommand.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php index dcb853d09c3..8dce715c304 100644 --- a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php +++ b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php @@ -5,6 +5,7 @@ use Exception; use Hyde\Framework\Concerns\Internal\TransfersMediaAssetsForBuildCommands; use Hyde\Framework\Hyde; +use Hyde\Framework\Services\BuildService; use Hyde\Framework\Services\DiscoveryService; use Hyde\Framework\Services\RebuildService; use LaravelZero\Framework\Commands\Command; @@ -50,7 +51,7 @@ public function handle(): int $time_start = microtime(true); if ($this->argument('path') === '_media') { - $this->transferMediaAssets(); + (new BuildService($this->getOutput()))->transferMediaAssets(); return 0; } From a8851956649f50d63e2deb9159620ab44677b104 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 31 Jul 2022 17:24:22 +0200 Subject: [PATCH 3/4] Remove deprecated trait usage --- .../framework/src/Commands/HydeRebuildStaticSiteCommand.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php index 8dce715c304..3915ea85ac8 100644 --- a/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php +++ b/packages/framework/src/Commands/HydeRebuildStaticSiteCommand.php @@ -3,7 +3,6 @@ namespace Hyde\Framework\Commands; use Exception; -use Hyde\Framework\Concerns\Internal\TransfersMediaAssetsForBuildCommands; use Hyde\Framework\Hyde; use Hyde\Framework\Services\BuildService; use Hyde\Framework\Services\DiscoveryService; @@ -17,8 +16,6 @@ */ class HydeRebuildStaticSiteCommand extends Command { - use TransfersMediaAssetsForBuildCommands; - /** * The signature of the command. * From 411c56edc1188e5a60fbed2e1ad2d8c5cdc98dc5 Mon Sep 17 00:00:00 2001 From: Caen De Silva Date: Sun, 31 Jul 2022 17:25:04 +0200 Subject: [PATCH 4/4] Delete internal TransfersMediaAssetsForBuildCommands.php --- .../TransfersMediaAssetsForBuildCommands.php | 41 ------------------- 1 file changed, 41 deletions(-) delete mode 100644 packages/framework/src/Concerns/Internal/TransfersMediaAssetsForBuildCommands.php diff --git a/packages/framework/src/Concerns/Internal/TransfersMediaAssetsForBuildCommands.php b/packages/framework/src/Concerns/Internal/TransfersMediaAssetsForBuildCommands.php deleted file mode 100644 index b3c4b45144c..00000000000 --- a/packages/framework/src/Concerns/Internal/TransfersMediaAssetsForBuildCommands.php +++ /dev/null @@ -1,41 +0,0 @@ -needsDirectory(Hyde::getSiteOutputPath('media')); - - $collection = DiscoveryService::getMediaAssetFiles(); - if ($this->canRunBuildAction($collection, 'Media Assets', 'Transferring')) { - $this->withProgressBar( - $collection, - function ($filepath) { - copy($filepath, Hyde::getSiteOutputPath('media/'.basename($filepath))); - } - ); - $this->newLine(2); - } - } - - protected function canRunBuildAction(): bool - { - return true; - } -}