-
-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow config and temp directories to be configured independently. (#763)
- Loading branch information
1 parent
47b77b2
commit 7263152
Showing
12 changed files
with
215 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
<?php | ||
|
||
namespace Knuckles\Scribe\Configuration; | ||
|
||
/** | ||
* A home for path configurations. The important paths Scribe depends on. | ||
*/ | ||
class PathConfig | ||
{ | ||
public function __construct( | ||
public string $configName = 'scribe', | ||
// FOr lack of a better name, we'll call this `scribeDir`. | ||
// It's sort of the cache dir, where Scribe stores its intermediate outputs. | ||
protected ?string $scribeDir = null | ||
) | ||
{ | ||
if (is_null($this->scribeDir)) { | ||
$this->scribeDir = ".{$this->configName}"; | ||
} | ||
} | ||
|
||
public function outputPath(string $resolvePath = null, string $separator = '/'): string | ||
{ | ||
if (is_null($resolvePath)) { | ||
return $this->configName; | ||
} | ||
|
||
return "{$this->configName}{$separator}{$resolvePath}"; | ||
} | ||
|
||
public function configFileName(): string | ||
{ | ||
return "{$this->configName}.php"; | ||
} | ||
|
||
/** | ||
* The directory where Scribe writes its intermediate output (default is .<config> ie .scribe) | ||
*/ | ||
public function intermediateOutputPath(string $resolvePath = null, string $separator = '/'): string | ||
{ | ||
if (is_null($resolvePath)) { | ||
return $this->scribeDir; | ||
} | ||
|
||
return "{$this->scribeDir}{$separator}{$resolvePath}"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.