-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Store documentation file on a configurable directory #152
base: master
Are you sure you want to change the base?
feat: Store documentation file on a configurable directory #152
Conversation
@hans-thomas I've updated task description, please add required changes accordingly the new task description (please feel free to open few PRs if you can divide task for small subtasks without breaking the package work) |
@hans-thomas please do not use autoclosing issues as we need to test task before closing |
The `production_path` key renamed to `base_file_name` for both local and storage drivers;
Hi @DenTray, would you please review this PR? |
src/Drivers/LocalDriver.php
Outdated
|
||
if (empty($this->prodFilePath)) { | ||
$directory = str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$directory = str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR) | |
$directory = (str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made this change but I can't understand the difference.
src/Drivers/StorageDriver.php
Outdated
|
||
if (empty($this->prodFilePath)) { | ||
$directory = str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as you already did the same in the local driver, let's move this logic to the BaseDriver class
$directory = str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR) | |
$directory = (str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR)) |
Force set documentation directory as empty for AutoDocControllerTest;
ee90fc7
to
cef046b
Compare
src/Drivers/StorageDriver.php
Outdated
|
||
if (empty($this->prodFilePath)) { | ||
$directory = (str_ends_with($this->config['directory'], DIRECTORY_SEPARATOR)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure this logic required for the Storage driver as it works correctly for all next cases:
- Storage::put('file.txt', 'content')
- Storage::put('/path/file.txt', 'content')
- Storage::put('path/file.txt', 'content')
- Storage::put('/file.txt', 'content')
- Storage::put('//file.txt', 'content')
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That logic was preventing this case:
Storage::put('documentations//documentation.json', 'content')
However, it's handling this case correctly, too.
$driver = new LocalDriver(); | ||
$driver->saveTmpData(self::$tmpData); | ||
|
||
$this->assertFileExists(self::$tmpDocumentationFilePath); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->assertFileExists(self::$tmpDocumentationFilePath); | |
$this->assertFileExists(storage_path('documentations/documentation.json')); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These static properties are used several times in this class and I believe they are beneficial to keep tests simpler and improve the readability.
|
Hi, it adds the ability to store the generated documentation file in a configurable directory.
TODO list:
directory
with the default valuedocumentations
production_path
config for Local and Storage drivers should be renamed tobase_file_name
with the default valuedocumentation
(without.json
extension).json
extension