From 5954af5a74bd33619381717a7a5a71fe6ada98c1 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Mon, 26 Apr 2021 23:48:35 +0200 Subject: [PATCH] Add binairy to generate client --- .gitignore | 2 ++ bin/openapi-client-generator.source | 24 +++++++++++++ composer.json | 14 +++++++- composer.lock | 52 ++++++++++++++++++++++++++++- openapi-client.yaml | 3 ++ test.php | 6 ---- 6 files changed, 93 insertions(+), 8 deletions(-) create mode 100644 .gitignore create mode 100755 bin/openapi-client-generator.source create mode 100644 openapi-client.yaml delete mode 100644 test.php diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d186c86 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +bin/openapi-client-generator +vendor \ No newline at end of file diff --git a/bin/openapi-client-generator.source b/bin/openapi-client-generator.source new file mode 100755 index 0000000..e5db6af --- /dev/null +++ b/bin/openapi-client-generator.source @@ -0,0 +1,24 @@ +#!/usr/bin/php +generate($yaml['namespace'] . '\\', $yaml['destination']); + + return 0; + })($configuration)); +})($argv[1]); \ No newline at end of file diff --git a/composer.json b/composer.json index f52561c..2a51504 100644 --- a/composer.json +++ b/composer.json @@ -8,6 +8,16 @@ "email": "ceesjank@gmail.com" } ], + "bin": [ + "bin/openapi-client-generator" + ], + "extra": { + "wyrihaximus": { + "bin-autoload-path-update": [ + "bin/openapi-client-generator" + ] + } + }, "require": { "php": "^7.4", "cebe/php-openapi": "^1.4", @@ -15,7 +25,9 @@ "twig/twig": "^3.0", "nikic/php-parser": "^4.8", "psr/http-message": "^1.0", - "ringcentral/psr7": "^1.3" + "ringcentral/psr7": "^1.3", + "symfony/yaml": "^5.2", + "wyrihaximus/composer-update-bin-autoload-path": "^1 || ^1.0.1" }, "autoload": { "psr-4": { diff --git a/composer.lock b/composer.lock index ad0c6dd..67c43c9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "e405fcadc613450f1f7de5d43cbf30c4", + "content-hash": "b8f8d368c9240b9aec0613c908ac044d", "packages": [ { "name": "cebe/php-openapi", @@ -750,6 +750,56 @@ } ], "time": "2021-02-08T09:54:36+00:00" + }, + { + "name": "wyrihaximus/composer-update-bin-autoload-path", + "version": "1.1.1", + "source": { + "type": "git", + "url": "https://github.com/WyriHaximus/php-composer-update-bin-autoload-path.git", + "reference": "33413e3af4f4d7ab4de3653a706aed57f51e84af" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WyriHaximus/php-composer-update-bin-autoload-path/zipball/33413e3af4f4d7ab4de3653a706aed57f51e84af", + "reference": "33413e3af4f4d7ab4de3653a706aed57f51e84af", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^2", + "php": "^8 || ^7.4" + }, + "require-dev": { + "wyrihaximus/test-utilities": "^3" + }, + "type": "composer-plugin", + "extra": { + "class": "WyriHaximus\\Composer\\BinAutoloadPathUpdater", + "unused": [ + "php" + ] + }, + "autoload": { + "psr-4": { + "WyriHaximus\\Composer\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "🏰 Composer plugin that fills a bin file with the absolute composer autoload path", + "support": { + "issues": "https://github.com/WyriHaximus/php-composer-update-bin-autoload-path/issues", + "source": "https://github.com/WyriHaximus/php-composer-update-bin-autoload-path/tree/1.1.1" + }, + "funding": [ + { + "url": "https://github.com/WyriHaximus", + "type": "github" + } + ], + "time": "2021-03-14T20:55:38+00:00" } ], "packages-dev": [], diff --git a/openapi-client.yaml b/openapi-client.yaml new file mode 100644 index 0000000..ee522ba --- /dev/null +++ b/openapi-client.yaml @@ -0,0 +1,3 @@ +spec: https://raw.githubusercontent.com/github/rest-api-description/main/descriptions/api.github.com/api.github.com.yaml +namespace: ApiClients\Client\Github +destination: generated diff --git a/test.php b/test.php deleted file mode 100644 index 536d054..0000000 --- a/test.php +++ /dev/null @@ -1,6 +0,0 @@ -generate('ApiClients\Github\\', 'generated');