diff options
Diffstat (limited to 'src/GitModule.php')
-rw-r--r-- | src/GitModule.php | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/GitModule.php b/src/GitModule.php index 3927992..39112a2 100644 --- a/src/GitModule.php +++ b/src/GitModule.php @@ -4,11 +4,12 @@ namespace PHPIAC\Modules; use PHPIAC\Connection; use PHPIAC\Module\Module; +use PHPIAC\Modules\Support\HandlesFiles; use PHPIAC\Modules\Support\HasPermissions; class GitModule extends Module { - use HasPermissions; + use HasPermissions, HandlesFiles; protected string $repo; protected string $dest; @@ -18,28 +19,17 @@ class GitModule extends Module */ public function checkState(): bool { - Connection::enablePty(); - - Connection::exec("ls $this->dest"); - $ls = Connection::read(); - - $state = ! str_contains($ls, 'No such file or directory'); - - Connection::disablePty(); - - return $state; + return $this->fileExists($this->dest); } /** * @inheritDoc */ - public function getCommands(): array + public function execute(): void { Connection::exec( "sudo git clone $this->repo $this->dest" . PHP_EOL . $this->getPermissions($this->dest) ); - - return []; } } |