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",
diff --git a/src/Generator.php b/src/Generator.php
index 6c07170..3d4d157 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,17 @@ public function workers(int $workers)
return $this;
}
- public function after($after)
+ public function after($after, $id = 'unidentified')
{
- $this->after = $after;
+ $this->after[$id] = $after;
return $this;
}
+
+ public function skipAfter( string $id )
+ {
+ $this->skipAfter[] = $id;
+ }
public function addUrls($closure)
{
@@ -107,8 +115,15 @@ 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);
+ }
}
}