1
0
Fork 0
mirror of synced 2024-06-22 04:30:29 +12:00

Updated SDK generator task

This commit is contained in:
eldadfux 2019-05-24 08:27:16 +03:00
parent 0b4959d7f6
commit fe06d71e98
3 changed files with 393 additions and 81 deletions

View file

@ -1,20 +1,21 @@
#!/bin/env php
<?php
require_once __DIR__ . '/../../../vendor/autoload.php';
require_once __DIR__ . '/../../vendor/autoload.php';
use Utopia\CLI\CLI;
use Utopia\CLI\Console;
use Spec\Swagger2;
use SDK\SDK;
use SDK\Language\PHP;
use SDK\Language\JS;
use Appwrite\Spec\Swagger2;
use Appwrite\SDK\SDK;
use Appwrite\SDK\Language\PHP;
use Appwrite\SDK\Language\JS;
use Appwrite\SDK\Language\Python;
use Appwrite\SDK\Language\Ruby;
$cli = new CLI();
$cli
->task('generate')
//->param('language', '', new Text(64), 'Version Name', false)
->action(function () {
function getSSLPage($url) {
@ -31,6 +32,7 @@ $cli
Console::success('Fetching API Spec');
$spec = getSSLPage('https://appwrite.test/v1/open-api-2.json');
$spec = getSSLPage('https://appwrite.io/v1/open-api-2.json');
$clients = [
@ -50,6 +52,22 @@ $cli
'gitRepoName' => 'sdk-for-js',
'gitUserName' => 'appwrite',
],
'python' => [
'version' => 'v1.0.0',
'result' => __DIR__ . '/../sdks/python/',
'gitURL' => 'https://github.com/appwrite/sdk-for-python.git',
'gitRepo' => 'git@github.com:appwrite/sdk-for-python.git',
'gitRepoName' => 'sdk-for-python',
'gitUserName' => 'appwrite',
],
'ruby' => [
'version' => 'v1.0.0',
'result' => __DIR__ . '/../sdks/ruby/',
'gitURL' => 'https://github.com/appwrite/sdk-for-ruby.git',
'gitRepo' => 'git@github.com:appwrite/sdk-for-ruby.git',
'gitRepoName' => 'sdk-for-ruby',
'gitUserName' => 'appwrite',
],
];
foreach ($clients as $name => $client) {
@ -60,17 +78,29 @@ $cli
->setComposerVendor('appwrite')
->setComposerPackage('appwrite')
;
break;
break;
case 'js':
$language = new JS();
$language
->setNPMPackage('appwrite')
->setBowerPackage('appwrite')
;
break;
break;
case 'python':
$language = new Python();
$language
->setPipPackage('appwrite')
;
break;
case 'ruby':
$language = new Ruby();
$language
->setGemPackage('appwrite')
;
break;
default:
throw new Exception('Language not supported');
break;
break;
}
$sdk = new SDK($language, new Swagger2($spec));
@ -103,12 +133,13 @@ SOFTWARE.")
->setGitURL($client['gitURL'])
->setGitRepoName($client['gitRepoName'])
->setGitUserName($client['gitUserName'])
->setLogo('https://appwrite.io/images/github.png')
->setLogo('https://appwrite.io/v1/images/github.png')
->setURL('https://appwrite.io')
->setShareText('Appwrite is a backend as a service for building web or mobile apps')
->setShareURL('http://appwrite.io')
->setShareTags('JS,javascript,reactjs,angular,ios,android')
->setShareVia('appwrite_io')
->setWarning('**WORK IN PROGRESS - NOT READY FOR USAGE**')
;
$target = __DIR__ . '/../sdks/git/' . $name;

View file

@ -37,6 +37,7 @@
"ext-zlib": "*",
"ext-sockets": "*",
"appwrite/sdk-generator": "master",
"appwrite/php-clamav": "master",
"utopia-php/framework": "master",

422
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"content-hash": "c1d8468f36e74c0212272b585e01ffaf",
"content-hash": "3c90b0bc44a105e53789f468c0060682",
"packages": [
{
"name": "appwrite/php-clamav",
@ -51,6 +51,51 @@
],
"time": "2019-05-11 15:12:28"
},
{
"name": "appwrite/sdk-generator",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/appwrite/sdk-generator.git",
"reference": "29d7fa8982b7e7823ab02208f360fbaa7d211d18"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/appwrite/sdk-generator/zipball/29d7fa8982b7e7823ab02208f360fbaa7d211d18",
"reference": "29d7fa8982b7e7823ab02208f360fbaa7d211d18",
"shasum": ""
},
"require": {
"ext-curl": "*",
"ext-json": "*",
"ext-mbstring": "*",
"matthiasmullie/minify": "^1.3",
"php": ">=7.2.0",
"twig/twig": "^2.0"
},
"require-dev": {
"phpunit/phpunit": "3.7.35"
},
"type": "library",
"autoload": {
"psr-4": {
"Appwrite\\SDK\\": "src/SDK",
"Appwrite\\Spec\\": "src/Spec"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Eldad Fux",
"email": "eldad@appwrite.io"
}
],
"description": "Appwrite PHP library for generating API SDKs for multiple programming languages and platforms",
"time": "2019-05-23 10:43:11"
},
{
"name": "bacon/bacon-qr-code",
"version": "2.0.0",
@ -579,12 +624,12 @@
"source": {
"type": "git",
"url": "https://github.com/guzzle/guzzle.git",
"reference": "bf595424e4d442a190582e088985dc835a789071"
"reference": "ca2892a8c2778c1821899fd2c79932e3b895f2ad"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/bf595424e4d442a190582e088985dc835a789071",
"reference": "bf595424e4d442a190582e088985dc835a789071",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/ca2892a8c2778c1821899fd2c79932e3b895f2ad",
"reference": "ca2892a8c2778c1821899fd2c79932e3b895f2ad",
"shasum": ""
},
"require": {
@ -637,7 +682,7 @@
"rest",
"web service"
],
"time": "2019-04-15 08:22:37"
"time": "2019-05-12 12:35:22"
},
{
"name": "guzzlehttp/promises",
@ -821,6 +866,115 @@
],
"time": "2018-07-06T10:13:39+00:00"
},
{
"name": "matthiasmullie/minify",
"version": "1.3.61",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/minify.git",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/minify/zipball/d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"reference": "d5acb8ce5b6acb7d11bafe97cecc533f6e4fd751",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"matthiasmullie/path-converter": "~1.1",
"php": ">=5.3.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.0",
"matthiasmullie/scrapbook": "~1.0",
"phpunit/phpunit": "~4.8"
},
"suggest": {
"psr/cache-implementation": "Cache implementation to use with Minify::cache"
},
"bin": [
"bin/minifycss",
"bin/minifyjs"
],
"type": "library",
"autoload": {
"psr-4": {
"MatthiasMullie\\Minify\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthias Mullie",
"email": "minify@mullie.eu",
"homepage": "http://www.mullie.eu",
"role": "Developer"
}
],
"description": "CSS & JavaScript minifier, in PHP. Removes whitespace, strips comments, combines files (incl. @import statements and small assets in CSS files), and optimizes/shortens a few common programming patterns.",
"homepage": "http://www.minifier.org",
"keywords": [
"JS",
"css",
"javascript",
"minifier",
"minify"
],
"time": "2018-11-26T23:10:39+00:00"
},
{
"name": "matthiasmullie/path-converter",
"version": "1.1.2",
"source": {
"type": "git",
"url": "https://github.com/matthiasmullie/path-converter.git",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/matthiasmullie/path-converter/zipball/5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"reference": "5e4b121c8b9f97c80835c1d878b0812ba1d607c9",
"shasum": ""
},
"require": {
"ext-pcre": "*",
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "~4.8"
},
"type": "library",
"autoload": {
"psr-4": {
"MatthiasMullie\\PathConverter\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Matthias Mullie",
"email": "pathconverter@mullie.eu",
"homepage": "http://www.mullie.eu",
"role": "Developer"
}
],
"description": "Relative path converter",
"homepage": "http://github.com/matthiasmullie/path-converter",
"keywords": [
"converter",
"path",
"paths",
"relative"
],
"time": "2018-10-25T15:19:41+00:00"
},
{
"name": "maxmind-db/reader",
"version": "v1.4.1",
@ -1225,6 +1379,190 @@
],
"time": "2018-08-18T19:41:03+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "82ebae02209c21113908c229e9883c419720738a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
"reference": "82ebae02209c21113908c229e9883c419720738a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2019-02-06 07:57:58"
},
{
"name": "symfony/polyfill-mbstring",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fe5e94c604826c35a32fa832f35bd036b6799609",
"reference": "fe5e94c604826c35a32fa832f35bd036b6799609",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-mbstring": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Mbstring\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Nicolas Grekas",
"email": "p@tchwork.com"
},
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
}
],
"description": "Symfony polyfill for the Mbstring extension",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"mbstring",
"polyfill",
"portable",
"shim"
],
"time": "2019-02-06 07:57:58"
},
{
"name": "twig/twig",
"version": "2.x-dev",
"source": {
"type": "git",
"url": "https://github.com/twigphp/Twig.git",
"reference": "24a8e38c659cdb6348726a2afbd664b8b3e5c63f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/24a8e38c659cdb6348726a2afbd664b8b3e5c63f",
"reference": "24a8e38c659cdb6348726a2afbd664b8b3e5c63f",
"shasum": ""
},
"require": {
"php": "^7.0",
"symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3"
},
"require-dev": {
"psr/container": "^1.0",
"symfony/debug": "^2.7",
"symfony/phpunit-bridge": "^3.4.19|^4.1.8"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.11-dev"
}
},
"autoload": {
"psr-0": {
"Twig_": "lib/"
},
"psr-4": {
"Twig\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Fabien Potencier",
"email": "fabien@symfony.com",
"homepage": "http://fabien.potencier.org",
"role": "Lead Developer"
},
{
"name": "Armin Ronacher",
"email": "armin.ronacher@active-4.com",
"role": "Project Founder"
},
{
"name": "Twig Team",
"homepage": "https://twig.symfony.com/contributors",
"role": "Contributors"
}
],
"description": "Twig, the flexible, fast, and secure template language for PHP",
"homepage": "https://twig.symfony.com",
"keywords": [
"templating"
],
"time": "2019-05-22 13:59:33"
},
{
"name": "utopia-php/abuse",
"version": "dev-master",
@ -1373,12 +1711,12 @@
"source": {
"type": "git",
"url": "https://github.com/utopia-php/framework.git",
"reference": "6f9c21cd0a36f88efd69f485b975132dcfa8a013"
"reference": "08915f42958282f3ec281c2e4629c9a18d1e833d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/6f9c21cd0a36f88efd69f485b975132dcfa8a013",
"reference": "6f9c21cd0a36f88efd69f485b975132dcfa8a013",
"url": "https://api.github.com/repos/utopia-php/framework/zipball/08915f42958282f3ec281c2e4629c9a18d1e833d",
"reference": "08915f42958282f3ec281c2e4629c9a18d1e833d",
"shasum": ""
},
"require": {
@ -1409,7 +1747,7 @@
"php",
"upf"
],
"time": "2019-05-08 20:22:08"
"time": "2019-05-14 19:43:55"
},
{
"name": "utopia-php/locale",
@ -2185,12 +2523,12 @@
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "d7d9cee051d03ed98df6023aad93f7902731a780"
"reference": "1d4dfbf6cd3a50aaceb7af96ba5dbb5b518f7434"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/d7d9cee051d03ed98df6023aad93f7902731a780",
"reference": "d7d9cee051d03ed98df6023aad93f7902731a780",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/1d4dfbf6cd3a50aaceb7af96ba5dbb5b518f7434",
"reference": "1d4dfbf6cd3a50aaceb7af96ba5dbb5b518f7434",
"shasum": ""
},
"require": {
@ -2261,7 +2599,7 @@
"testing",
"xunit"
],
"time": "2019-05-09T05:06:47+00:00"
"time": "2019-05-20T18:38:43+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
@ -2829,64 +3167,6 @@
"homepage": "https://github.com/sebastianbergmann/version",
"time": "2016-10-03T07:35:21+00:00"
},
{
"name": "symfony/polyfill-ctype",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "82ebae02209c21113908c229e9883c419720738a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/82ebae02209c21113908c229e9883c419720738a",
"reference": "82ebae02209c21113908c229e9883c419720738a",
"shasum": ""
},
"require": {
"php": ">=5.3.3"
},
"suggest": {
"ext-ctype": "For best performance"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.11-dev"
}
},
"autoload": {
"psr-4": {
"Symfony\\Polyfill\\Ctype\\": ""
},
"files": [
"bootstrap.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Symfony Community",
"homepage": "https://symfony.com/contributors"
},
{
"name": "Gert de Pagter",
"email": "BackEndTea@gmail.com"
}
],
"description": "Symfony polyfill for ctype functions",
"homepage": "https://symfony.com",
"keywords": [
"compatibility",
"ctype",
"polyfill",
"portable"
],
"time": "2019-02-06T07:57:58+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.1.2",