This is my contribution to Superalgos
This commit is contained in:
1 parent
0a6cb07b63
commit
874a3cde1c
2 files changed
+30
-11
No files matched your search
+28
-9
@@ -525,16 +525,35 @@ exports.newHttpInterface = function newHttpInterface(WEB_SERVER, DATA_FILE_SERVE
|
||||
case 'App': {
|
||||
switch (requestParameters[2]) { // switch by command
|
||||
case 'Contribute': {
|
||||
const simpleGit = require('simple-git');
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
maxConcurrentProcesses: 6,
|
||||
try {
|
||||
const simpleGit = require('simple-git');
|
||||
const options = {
|
||||
baseDir: process.cwd(),
|
||||
binary: 'git',
|
||||
maxConcurrentProcesses: 6,
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
const commitMessage = unescape(requestParameters[3])
|
||||
git.add('./*')
|
||||
git.commit(commitMessage, onCommit)
|
||||
|
||||
function onCommit(err) {
|
||||
console.log(err)
|
||||
if (err) {throw err}
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> Method call produced an error.')
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpInterface -> App -> Contribute -> Params Received = ' + requestParameters[3])
|
||||
|
||||
let error = {
|
||||
result: 'Fail Because',
|
||||
message: err.message,
|
||||
stack: err.stack
|
||||
}
|
||||
respondWithContent(JSON.stringify(error), httpResponse)
|
||||
}
|
||||
const git = simpleGit(options)
|
||||
const commitMessage = unescape(requestParameters[3])
|
||||
console.log('baseDir = ' + process.cwd(), commitMessage)
|
||||
respondWithContent(JSON.stringify(global.DEFAULT_OK_RESPONSE), httpResponse)
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,9 +43,9 @@ 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.DEFAULT_OK_RESPONSE.result) {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Contribution Not Sent', 'Anchor Contribution Not Sent')
|
||||
} else {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Message Contribution Succeed')
|
||||
} else {
|
||||
UI.projects.superalgos.spaces.docsSpace.navigateTo('Superalgos', 'Topic', 'App Error Contribution Not Sent', 'Anchor Contribution Not Sent')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user