From b0f7f04ba6c5412d54e0a720cf4d583baa781bf6 Mon Sep 17 00:00:00 2001 From: Marko Date: Tue, 19 Jul 2022 15:39:38 +0200 Subject: [PATCH] add deploy.yaml --- .drone.yml | 14 ++++++++++- README.md | 2 +- public/bundles/apiplatform/fetch/fetch.js | 22 +++++++--------- public/bundles/apiplatform/init-graphiql.js | 17 +++++-------- .../apiplatform/init-graphql-playground.js | 2 +- public/bundles/apiplatform/init-swagger-ui.js | 25 ++++++------------- 6 files changed, 38 insertions(+), 44 deletions(-) diff --git a/.drone.yml b/.drone.yml index 8c9ec5c..808e018 100644 --- a/.drone.yml +++ b/.drone.yml @@ -6,8 +6,20 @@ steps: image: composer commands: - composer install + - name: cleanup + image: php:8.1 + commands: + - apt-get update && apt-get install -y git zip + - curl -L https://phar.phpunit.de/phpunit.phar -o /usr/local/bin/phpunit + - curl -L https://squizlabs.github.io/PHP_CodeSniffer/phpcs.phar -o /usr/local/bin/phpcs + - curl -L https://squizlabs.github.io/PHP_CodeSniffer/phpcbf.phar -o /usr/local/bin/phpcbf + - chmod +x /usr/local/bin/phpunit + - chmod +x /usr/local/bin/phpcs + - chmod +x /usr/local/bin/phpcbf + - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer + - phpcs -n --standard=PSR2 . - name: test image: php:8.1 commands: - - vendor/bin/phpunit --configuration config.xml + - vendor/bin/phpunit diff --git a/README.md b/README.md index 3694383..d634bc0 100644 --- a/README.md +++ b/README.md @@ -16,5 +16,5 @@ Installiere Abhängigkeiten > make install Starte MySQL-Server: -> docker compose up +> docker compose up diff --git a/public/bundles/apiplatform/fetch/fetch.js b/public/bundles/apiplatform/fetch/fetch.js index d48020e..b60e7e1 100644 --- a/public/bundles/apiplatform/fetch/fetch.js +++ b/public/bundles/apiplatform/fetch/fetch.js @@ -17,8 +17,7 @@ exports.FetchStream = FetchStream; exports.CookieJar = CookieJar; exports.fetchUrl = fetchUrl; -function FetchStream(url, options) -{ +function FetchStream(url, options) { Stream.call(this); options = options || {}; @@ -173,7 +172,7 @@ FetchStream.prototype.parseUrl = function (url) { path: urlparts.pathname + (urlparts.search || '') || '/', method: this.options.method, rejectUnauthorized: this.options.rejectUnauthorized - }; + }; switch (urlparts.protocol) { case 'https:': @@ -186,17 +185,17 @@ FetchStream.prototype.parseUrl = function (url) { } if (transport === https) { - if ('agentHttps' in this.options) { + if('agentHttps' in this.options){ urloptions.agent = this.options.agentHttps; } - if ('agent' in this.options) { + if('agent' in this.options){ urloptions.agent = this.options.agent; } } else { - if ('agentHttp' in this.options) { + if('agentHttp' in this.options){ urloptions.agent = this.options.agentHttp; } - if ('agent' in this.options) { + if('agent' in this.options){ urloptions.agent = this.options.agent; } } @@ -383,8 +382,7 @@ FetchStream.prototype._runStream = function (url_data, url) { } }; -function fetchUrl(url, options, callback) -{ +function fetchUrl(url, options, callback) { if (!callback && typeof options === 'function') { callback = options; options = undefined; @@ -455,8 +453,7 @@ function fetchUrl(url, options, callback) }); } -function _parseContentType(str) -{ +function _parseContentType(str) { if (!str) { return {}; } @@ -479,8 +476,7 @@ function _parseContentType(str) }; } -function _findHTMLCharset(htmlbuffer) -{ +function _findHTMLCharset(htmlbuffer) { var body = htmlbuffer.toString('ascii'), input, meta, charset; diff --git a/public/bundles/apiplatform/init-graphiql.js b/public/bundles/apiplatform/init-graphiql.js index dce292e..f1447c2 100644 --- a/public/bundles/apiplatform/init-graphiql.js +++ b/public/bundles/apiplatform/init-graphiql.js @@ -1,26 +1,22 @@ var initParameters = {}; var entrypoint = null; -function onEditQuery(newQuery) -{ +function onEditQuery(newQuery) { initParameters.query = newQuery; updateURL(); } -function onEditVariables(newVariables) -{ +function onEditVariables(newVariables) { initParameters.variables = newVariables; updateURL(); } -function onEditOperationName(newOperationName) -{ +function onEditOperationName(newOperationName) { initParameters.operationName = newOperationName; updateURL(); } -function updateURL() -{ +function updateURL() { var newSearch = '?' + Object.keys(initParameters).filter(function (key) { return Boolean(initParameters[key]); }).map(function (key) { @@ -29,8 +25,7 @@ function updateURL() history.replaceState(null, null, newSearch); } -function graphQLFetcher(graphQLParams) -{ +function graphQLFetcher(graphQLParams) { return fetch(entrypoint, { method: 'post', headers: { @@ -50,7 +45,7 @@ function graphQLFetcher(graphQLParams) }); } -window.onload = function () { +window.onload = function() { var data = JSON.parse(document.getElementById('graphiql-data').innerText); entrypoint = data.entrypoint; diff --git a/public/bundles/apiplatform/init-graphql-playground.js b/public/bundles/apiplatform/init-graphql-playground.js index f4999dc..a69a243 100644 --- a/public/bundles/apiplatform/init-graphql-playground.js +++ b/public/bundles/apiplatform/init-graphql-playground.js @@ -1,4 +1,4 @@ -window.addEventListener('load', function (event) { +window.addEventListener('load', function(event) { var loadingWrapper = document.getElementById('loading-wrapper'); loadingWrapper.classList.add('fadeOut'); diff --git a/public/bundles/apiplatform/init-swagger-ui.js b/public/bundles/apiplatform/init-swagger-ui.js index 2c823b0..95f2b63 100644 --- a/public/bundles/apiplatform/init-swagger-ui.js +++ b/public/bundles/apiplatform/init-swagger-ui.js @@ -1,22 +1,18 @@ 'use strict'; -window.onload = function () { +window.onload = function() { manageWebbyDisplay(); new MutationObserver(function (mutations, self) { const op = document.getElementById(`operations-${data.shortName}-${data.operationId}`); - if (!op) { - return; - } + if (!op) return; self.disconnect(); op.querySelector('.opblock-summary').click(); const tryOutObserver = new MutationObserver(function (mutations, self) { const tryOut = op.querySelector('.try-out__btn'); - if (!tryOut) { - return; - } + if (!tryOut) return; self.disconnect(); @@ -35,7 +31,7 @@ window.onload = function () { } // Wait input values to be populated before executing the query - setTimeout(function () { + setTimeout(function(){ op.querySelector('.execute').click(); op.scrollIntoView(); }, 500); @@ -75,12 +71,10 @@ window.onload = function () { // Adapted from https://github.com/vitalyq/react-trigger-change/blob/master/lib/change.js // Copyright (c) 2017 Vitaly Kuznetsov // MIT License - function reactTriggerChange(node) - { + function reactTriggerChange(node) { // Do not try to delete non-configurable properties. // Value and checked properties on DOM elements are non-configurable in PhantomJS. - function deletePropertySafe(elem, prop) - { + function deletePropertySafe(elem, prop) { const desc = Object.getOwnPropertyDescriptor(elem, prop); if (desc && desc.configurable) { delete elem[prop]; @@ -135,12 +129,9 @@ window.onload = function () { } } - function manageWebbyDisplay() - { + function manageWebbyDisplay() { const webby = document.getElementsByClassName('webby')[0]; - if (!webby) { - return; - } + if (!webby) return; const web = document.getElementsByClassName('web')[0]; webby.classList.add('calm');