Only git working
This commit is contained in:
1 parent
9187a0ead9
commit
83354c5c10
2 files changed
+5
-59
No files matched your search
+1
-46
@@ -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) {
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in new issue
Block a user