diff --git a/src/StaticGenerator/StaticGenerator.php b/src/StaticGenerator/StaticGenerator.php deleted file mode 100644 index e15bf89..0000000 --- a/src/StaticGenerator/StaticGenerator.php +++ /dev/null @@ -1,55 +0,0 @@ -commandService->logWriter($signature); - $logWriter("Start " . Carbon::now()->format("Y-m-d H:i:s")); - $this->removeBuildDirectory(); - $logWriter("Removing previous data"); - try { - $callback(new Writer($logWriter)); - } catch (Throwable $th) { - $logWriter("Finished with errors" . Carbon::now()->format("Y-m-d H:i:s") . " " . $th->getMessage()); - } - - $this->copyBuildDirectory(); - $logWriter("Finished " . Carbon::now()->format("Y-m-d H:i:s")); - } - - private function removeBuildDirectory(): void - { - if (!file_exists(storage_path("lucent/build"))) { - return; - } - $cmd = "rm -rf " . storage_path("lucent/build"); - exec($cmd); - } - - private function copyBuildDirectory(): void - { - if (file_exists(storage_path("lucent/live"))) { - $cmd = "rm -rf " . storage_path("lucent/live"); - exec($cmd); - } - $cmd = sprintf("cp -R %s %s", storage_path("lucent/build"), storage_path("lucent/live")); - exec($cmd); - } - - -} diff --git a/src/StaticGenerator/Writer.php b/src/StaticGenerator/Writer.php deleted file mode 100644 index 2c6f5b7..0000000 --- a/src/StaticGenerator/Writer.php +++ /dev/null @@ -1,53 +0,0 @@ -buildPath($path. "/index.$extension"); - - if (!file_exists(pathinfo($filepath, PATHINFO_DIRNAME))) { - make_dir_r(pathinfo($filepath, PATHINFO_DIRNAME)); - } - file_put_contents($filepath, $html); - $logWriter = $this->logWriter; - $logWriter("Path: $path"); - } - - - - public function recordIterator(callable $query, callable $parser, int $skip = 0, $limit = 100): int - { - $records = $query($limit, $skip); - $parser($records, $limit, $skip); - - if ($records->count() > 0) { - return $this->recordIterator($query, $parser, $skip + $limit); - } - - return 0; - } - - public function createRedirect(string $from, string $to, string $title = "Redirecting", string $message = "Redirecting Soon..."): void - { - $html = view("lucent::redirect", [ - "to" => $to, - "title" => $title, - "message" => $message, - ])->render(); - $this->save($from, $html); - } -}