summaryrefslogtreecommitdiff
path: root/src/TemplateModule.php
diff options
context:
space:
mode:
Diffstat (limited to 'src/TemplateModule.php')
-rw-r--r--src/TemplateModule.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/TemplateModule.php b/src/TemplateModule.php
index 515d891..9bbb6f9 100644
--- a/src/TemplateModule.php
+++ b/src/TemplateModule.php
@@ -4,30 +4,38 @@ namespace PHPIAC\Modules;
use PHPIAC\Connection;
use PHPIAC\Module\Module;
+use PHPIAC\Modules\Support\HandlesFiles;
use PHPIAC\Modules\Support\HasPermissions;
use Twig\Environment;
use Twig\Loader\FilesystemLoader;
class TemplateModule extends Module
{
- use HasPermissions;
+ use HasPermissions, HandlesFiles;
protected string $src;
protected string $dest;
protected array $vars;
+ protected bool $force = false;
+
/**
* @inheritDoc
*/
public function checkState(): bool
{
- return false;
+ if ($this->force) {
+ return false;
+ // TODO: ContentsEqual?();
+ }
+
+ return $this->fileExists($this->dest);
}
/**
* @inheritDoc
*/
- public function getCommands(): array
+ public function execute(): void
{
$loader = new FilesystemLoader(dirname($this->src));
$twig = new Environment($loader);
@@ -36,7 +44,5 @@ class TemplateModule extends Module
Connection::put($this->dest, $rendered);
Connection::exec($this->getPermissions($this->dest));
-
- return [];
}
}