Skip to content

Commit

Permalink
Merge pull request #16
Browse files Browse the repository at this point in the history
Perfected symlink refresh
  • Loading branch information
leonardosahon authored Dec 29, 2023
2 parents 87d61a3 + c017a81 commit d0dcce4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/BobDBuilder/Cmd/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function create(): void
if($tag == "--refresh-links") {
$this->plug->write_info("Refreshing symlinks!");

(new Symlink())->refresh_link();
(new Symlink($this->plug))->refresh_link();
}

if($tag == "--force-refresh") {
Expand Down
16 changes: 15 additions & 1 deletion src/BobDBuilder/Cmd/Symlink.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ class Symlink implements CmdLayout
private EnginePlug $plug;
private static string $link_db;

public function __construct(?EnginePlug $plug = null)
{
if(!$plug)
return;

$this->plug = $plug;
$this->init_db();
}

public function _init(EnginePlug $plug): void
{
$this->plug = $plug;
Expand All @@ -26,13 +35,18 @@ public function _init(EnginePlug $plug): void

public function _spin(): void
{
self::$link_db = $this->plug->server->root . "symlinks.json";
$this->init_db();

$this->htaccess();
$this->dir();
$this->file();
}

private function init_db() : void
{
self::$link_db = $this->plug->server->root . "symlinks.json";
}

private function track_link(string $src, string $dest, string $link_type) : void
{
$new_link = [
Expand Down
1 change: 1 addition & 0 deletions src/BobDBuilder/EnginePlug.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ private function arg(string $cmd_class, array $cmd, &$pipe, int|bool ...$value_i
}

public function write_info(string $message, array $opts = []) : void {
$opts['hide_current_cmd'] = true;
$this->write($message, CmdOutType::INFO, $opts);
}

Expand Down

0 comments on commit d0dcce4

Please sign in to comment.