From 9373f2895a6a8022791fa43351c1d09419381f2c Mon Sep 17 00:00:00 2001 From: efc Date: Sat, 9 Aug 2025 13:52:51 -0500 Subject: [PATCH 1/4] remove dev-master --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index adc0197..733b357 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ } }, "require": { - "statamic/cms": "dev-master" + "statamic/cms": "^5.41" }, "require-dev": { "orchestra/testbench": "^9.6.1 || ^10.0", From 5d988c90039ac57628952084bb00ad525a4508db Mon Sep 17 00:00:00 2001 From: efc Date: Sat, 9 Aug 2025 14:55:49 -0500 Subject: [PATCH 2/4] accomodate multiple after callbacks --- src/Generator.php | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/src/Generator.php b/src/Generator.php index 6c07170..c55e396 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -36,6 +36,7 @@ class Generator protected $config; protected $request; protected $after; + protected $skipAfter; protected $extraUrls; protected $workers = 1; protected $earlyTaskErrors = []; @@ -50,6 +51,8 @@ public function __construct(Application $app, Filesystem $files, Router $router, $this->tasks = $tasks; $this->extraUrls = collect(); $this->config = $this->initializeConfig(); + $this->after = array(); + $this->skipAfter = array(); } private function initializeConfig() @@ -70,12 +73,15 @@ public function workers(int $workers) return $this; } - public function after($after) - { - $this->after = $after; + public function after($after, $id = 'unidentified') { + $this->after[$id] = $after; return $this; } + + public function skipAfter( string $id ) { + $this->skipAfter[] = $id; + } public function addUrls($closure) { @@ -107,10 +113,17 @@ public function generate($urls = '*') ->copyFiles() ->outputSummary(); - if ($this->after) { - call_user_func($this->after); + if ( count($this->after) > 0 ) { + foreach ($this->after as $id => $after) { + if (in_array($id, $this->skipAfter)) { + Partyline::line("Skipping $id after function..."); + continue; + } + Partyline::line("Calling $id after function..."); + call_user_func($after); + } + } } - } public function bindGlide() { From 7ede6af5c2afd331495f80ac038a29258fe889ad Mon Sep 17 00:00:00 2001 From: efc Date: Sat, 9 Aug 2025 14:59:26 -0500 Subject: [PATCH 3/4] fix indent --- src/Generator.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Generator.php b/src/Generator.php index c55e396..3244c6e 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -113,17 +113,17 @@ public function generate($urls = '*') ->copyFiles() ->outputSummary(); - if ( count($this->after) > 0 ) { - foreach ($this->after as $id => $after) { - if (in_array($id, $this->skipAfter)) { - Partyline::line("Skipping $id after function..."); - continue; - } - Partyline::line("Calling $id after function..."); - call_user_func($after); + if ( count($this->after) > 0 ) { + foreach ($this->after as $id => $after) { + if (in_array($id, $this->skipAfter)) { + Partyline::line("Skipping $id after function..."); + continue; } + Partyline::line("Calling $id after function..."); + call_user_func($after); } } + } public function bindGlide() { From dafdebb27f2495b772d47dd2d6df5f16028af53e Mon Sep 17 00:00:00 2001 From: efc Date: Sat, 9 Aug 2025 15:00:51 -0500 Subject: [PATCH 4/4] fix brackets --- src/Generator.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Generator.php b/src/Generator.php index 3244c6e..3d4d157 100644 --- a/src/Generator.php +++ b/src/Generator.php @@ -73,13 +73,15 @@ public function workers(int $workers) return $this; } - public function after($after, $id = 'unidentified') { + public function after($after, $id = 'unidentified') + { $this->after[$id] = $after; return $this; } - public function skipAfter( string $id ) { + public function skipAfter( string $id ) + { $this->skipAfter[] = $id; }