summaryrefslogtreecommitdiff
path: root/src/TemplateModule.php
diff options
context:
space:
mode:
authorDaniel Weipert <code@drogueronin.de>2021-04-28 13:58:55 +0200
committerDaniel Weipert <code@drogueronin.de>2021-04-28 13:58:55 +0200
commit20d9f63918d3b2bd75853182063f43eb36d7cd8a (patch)
treeb6f48898297f761dcec8532b524844cc968ec565 /src/TemplateModule.php
parent11dc8c730dda2c5bd38cb386f96331c5ce3cac9c (diff)
Adjusts modulesv1.0.0
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 [];
}
}