Skip to content

Commit

Permalink
Use correct paths when generating in multi-docs
Browse files Browse the repository at this point in the history
  • Loading branch information
shalvah committed Jul 27, 2022
1 parent 3276487 commit ac47c67
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/Writing/Writer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@

class Writer
{
/**
* The "name" of this docs instance. By default, it is "scribe".
* Used for multi-docs.
*/
public string $docsName;

private DocumentationConfig $config;

private bool $isStatic;
Expand All @@ -36,6 +42,7 @@ class Writer

public function __construct(DocumentationConfig $config = null, $docsName = 'scribe')
{
$this->docsName = $docsName;
$this->markdownOutputPath = ".{$docsName}"; //.scribe by default
$this->laravelTypeOutputPath = "resources/views/$docsName";
// If no config is injected, pull from global. Makes testing easier.
Expand Down Expand Up @@ -78,8 +85,8 @@ protected function writePostmanCollection(array $groups): void
$collectionPath = "{$this->staticTypeOutputPath}/collection.json";
file_put_contents($collectionPath, $collection);
} else {
Storage::disk('local')->put('scribe/collection.json', $collection);
$collectionPath = 'storage/app/scribe/collection.json';
Storage::disk('local')->put("{$this->docsName}/collection.json", $collection);
$collectionPath = "storage/app/{$this->docsName}/collection.json";
}

c::success("Wrote Postman collection to: {$collectionPath}");
Expand All @@ -97,8 +104,8 @@ protected function writeOpenAPISpec(array $parsedRoutes): void
$specPath = "{$this->staticTypeOutputPath}/openapi.yaml";
file_put_contents($specPath, $spec);
} else {
Storage::disk('local')->put('scribe/openapi.yaml', $spec);
$specPath = 'storage/app/scribe/openapi.yaml';
Storage::disk('local')->put("{$this->docsName}/openapi.yaml", $spec);
$specPath = "storage/app/{$this->docsName}/openapi.yaml";
}

c::success("Wrote OpenAPI specification to: {$specPath}");
Expand Down

0 comments on commit ac47c67

Please sign in to comment.