Skip to content
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

docs: gen readme #7

Merged
merged 10 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "Ubuntu",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/base:jammy",
"features": {
"ghcr.io/shyim/devcontainers-features/php:0": {
"version": "8.3"
}
}

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "uname -a",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
15 changes: 15 additions & 0 deletions .github/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# php-baserow-client

An API client for baserow.io

```shell
composer require cedricziel/baserow
```

## Docs

### docs ###

## License

Apache 2.0
8 changes: 8 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
assignees:
- cedricziel
commit-message:
prefix: "fix: "

# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/client-generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
- name: Run php-cs-fixer
uses: docker://oskarstark/php-cs-fixer-ga

- name: Generate README
run: php .regen-docs.php

- uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Apply php-cs-fixer changes
Expand Down
38 changes: 38 additions & 0 deletions .regen-docs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<?php

require_once __DIR__.'/vendor/autoload.php';

function underscoreToCamelCase($string, $capitalizeFirstCharacter = false)
{
$str = str_replace(' ', '', ucwords(str_replace('_', ' ', $string)));

if (!$capitalizeFirstCharacter) {
$str[0] = strtolower($str[0]);
}

return $str;
}

$readme = file_get_contents('./.github/README.md');
$json = json_decode(file_get_contents('openapi.json'), true);

$doc = '';

foreach ($json['paths'] as $pathName => $path) {
foreach ($path as $httpMethod => $method) {
$methodName = underscoreToCamelCase($method['operationId']);

$doc .= '### '.$method['operationId'].' - '."$httpMethod $pathName\n";
$doc .= "\n";
$doc .= $method['description'] ?? '';
$doc .= "\n\n";
$doc .= '```php'."\n";
$doc .= '$client = \\CedricZiel\\Baserow\\Client::create();'."\n";
$doc .= '$client->'."{$methodName}();\n";
$doc .= '```'."\n";
$doc .= "\n";
echo $method['operationId']."\n";
}
}

file_put_contents('README.md', str_replace('### docs ###', $doc, $readme));
5 changes: 5 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"recommendations": [
"bmewburn.vscode-intelephense-client"
]
}
Loading
Loading