From 83354c5c10c6a6dce6e6abbc243bfa1967157782 Mon Sep 17 00:00:00 2001 From: Luis Fernando Molina Date: Tue, 12 Jan 2021 13:22:38 +0100 Subject: [PATCH] Only git working --- Client/httpInterface.js | 47 +------------------ .../UI/Spaces/Docs-Space/CommandInterface.js | 17 ++----- 2 files changed, 5 insertions(+), 59 deletions(-) diff --git a/Client/httpInterface.js b/Client/httpInterface.js index 510427de3..e5858d785 100644 --- a/Client/httpInterface.js +++ b/Client/httpInterface.js @@ -611,7 +611,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE update() async function update() { - //await doGithub() let message = await doGit() let customResponse = { @@ -621,34 +620,6 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE respondWithContent(JSON.stringify(customResponse), httpResponse) } - async function doGithub() { - - const { Octokit } = require("@octokit/rest") - - const octokit = new Octokit({ - auth: token, - userAgent: 'Superalgos Beta 8' - }) - - const repo = 'Superalgos' - const owner = username - const head = 'upstream/in-app-documentation' - const base = 'in-app-documentation' - const commitMessage = 'Update: ' + message - - try { - await octokit.repos.merge({ - owner, - repo, - base, - head, - commitMessage - }); - } catch (err) { - throw (err) - } - } - async function doGit() { const simpleGit = require('simple-git'); const options = { @@ -658,23 +629,7 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE } const git = simpleGit(options) - return await git.pull('upstream', 'in-app-documentation', onPull) - - function onPull(err, update) { - if (update) { - if (update.summary.changes) { - return 'New Version Found' - } else { - return 'Already Up-To-Date' - } - } else { - if (err) { - throw (err) - } else { - return 'Not Updated' - } - } - } + return await git.pull('upstream', 'in-app-documentation') } } catch (err) { diff --git a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js index cbba59209..e645b8790 100644 --- a/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js +++ b/Projects/Superalgos/UI/Spaces/Docs-Space/CommandInterface.js @@ -121,19 +121,10 @@ function newSuperalgosDocsCommmandInterface() { /* Lets check the result of the call through the http interface */ data = JSON.parse(data) if (err.result === GLOBAL.DEFAULT_OK_RESPONSE.result && data.result === GLOBAL.CUSTOM_OK_RESPONSE.result) { - switch (data.message) { - case 'New Version Found': { - UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Update Succeed - New Version Found') - break - } - case 'Already Up-To-Date': { - UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Update Succeed - Already Up-To-Date') - break - } - case 'Not Updated': { - UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Update Failed', 'Anchor Update Failed') - break - } + if (data.message.summary.changes + data.message.summary.deletions + data.message.summary.insertions > 0) { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Update Succeed - New Version Found') + } else { + UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Update Succeed - Already Up-To-Date') } } else { UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Update Failed', 'Anchor Update Failed')