-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #56 from 5pm-HDH/feature/doc-generator
DocGenerator
- Loading branch information
Showing
45 changed files
with
1,825 additions
and
223 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: Doc-Generator | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Setup PHP8.0 | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '8.0' | ||
|
||
- uses: actions/checkout@v2 | ||
|
||
- name: Validate composer.json and composer.lock | ||
run: composer validate --strict | ||
|
||
- name: Cache Composer packages | ||
id: composer-cache | ||
uses: actions/cache@v2 | ||
with: | ||
path: vendor | ||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }} | ||
restore-keys: | | ||
${{ runner.os }}-php- | ||
- name: Install dependencies | ||
if: steps.composer-cache.outputs.cache-hit != 'true' | ||
run: composer install --prefer-dist --no-progress | ||
|
||
- name: Composer dump-autoload to load all files | ||
run: composer dump-autoload | ||
|
||
- name: Generate Docs | ||
run: composer run-script docs-generator | ||
|
||
- name: Check if Docs are already generated | ||
uses: tj-actions/verify-changed-files@v8.8 | ||
id: verify-changed-files | ||
with: | ||
files: | | ||
docs | ||
- name: Run step only when files change. | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
run: | | ||
core.setFailed('Inconsistent Docs. Please run DocGenerator and check in changed Files.') |
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
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,40 @@ | ||
# Documentation | ||
|
||
The Documentation in the `docs`-Directory are generated by the DocGenerator-Script. The DocGenerator can be executed by composer: | ||
|
||
``` | ||
composer run-script docs-generator | ||
``` | ||
|
||
The Generator will then execute every PHP-Code example to ensure that they are executable! The Template-Docs are stored in the `docs/src/ressources`-Directory. | ||
|
||
|
||
## Template-Docs | ||
|
||
The Doc-Templates are MD-Files contain all the information the Doc should contain. Only the PHP-Code examples are processed by the DocGenerator-Script. This Script executes the Code-Examples and display the result in the generated Doc. | ||
|
||
This example Code-Snippet... | ||
|
||
```php | ||
$a = 2 + 2; | ||
dd($a); | ||
``` | ||
|
||
...will be transfered to this Doc: | ||
|
||
```php | ||
$a = 2 + 2; | ||
echo ($a); | ||
// OUTPUT: 4 | ||
``` | ||
|
||
The Generator converts the "dd"-Function call to an "echo" call. In the next Line it will display the content of the variable $a. | ||
|
||
⚠ The `dd(...)`-Method is not allowed in any kind of Loop or If/Switch-Statement.⚠ | ||
|
||
## Execution Enviroment | ||
The Generator-Script builds the CTClientMock-Enviroment. All Http calls are redirected to the Json-Files in the `tests/unit/HttpMock/data`-directory. | ||
|
||
## Github-Action | ||
|
||
If you change something in the template-docs please call the generator-script. The Github-Action "doc-generator" will check if there is any inconsistency between the template-docs and the generated docs. |
Oops, something went wrong.