Browse Source

Merge branch 'master' of http://git.bbh/chess/elxr into master

master
samuel 3 years ago
parent
commit
68a7378000
3 changed files with 24 additions and 25 deletions
  1. 9
    3
      index.js
  2. 0
    22
      repolog.js
  3. 15
    0
      result.js

+ 9
- 3
index.js View File

var repolog = require('./repolog')
var statuslog = require('./result')
var path = require('path'); var path = require('path');
var utils = require('bbhverse'); var utils = require('bbhverse');
var any = utils.any; var any = utils.any;
var currentGitAuthUser ; // nodeShellExec('git', ['config', 'user.email']) ... PB : TODO-- get the current gittea username var currentGitAuthUser ; // nodeShellExec('git', ['config', 'user.email']) ... PB : TODO-- get the current gittea username
var defaultRepoOwner = 'chess'; var defaultRepoOwner = 'chess';


// PB : TODO -- If we are run from an elevated shell it never moves forward and simply exits.
// -- Currently workaround is to always run from a non-elevated shell.
var __isElevated = null; var __isElevated = null;
var isRunningElevated = ()=>{ var isRunningElevated = ()=>{
if(__isElevated === null) { if(__isElevated === null) {
if(existsSync(repo)) { if(existsSync(repo)) {
console.log('pulling ' + repo) console.log('pulling ' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).then((srepo)=>{ return nodeShellExec.apply(null, getPullCmd(repo)).then((srepo)=>{
repolog.statuslog(null, srepo)}).catch((e)=>{ console.error(e) })
statuslog.statuslog(null, srepo)}).catch((e)=>{ statuslog.statuslog(e, srepo); console.error(e) })
} }
else { else {
// PB : TODO -- detect if a clonable repo exists in currentGitAuthUser // PB : TODO -- detect if a clonable repo exists in currentGitAuthUser
pendingpulls.push(performPull(r)) pendingpulls.push(performPull(r))
} ) } )
Promise.all(pendingpulls).then(results =>{ Promise.all(pendingpulls).then(results =>{
console.log(repolog.log.SUCCESS)
// console.log(statuslog.log.SUCCESS)
console.log('Total : ' + (statuslog.log.SKIPPED.length + statuslog.log.SUCCESS.length + statuslog.log.FAILURE.length))
console.log('Pass : ' + statuslog.log.SUCCESS.length )
console.log('Fail : ' + statuslog.log.FAILURE.length)
console.log('Skipped : ' + statuslog.log.SKIPPED.length)
}) })
} }
return isRunningElevated().then( return isRunningElevated().then(

+ 0
- 22
repolog.js View File

var log = {
SUCCESS : []
, ERROR : []
, FAIL : []
}

var statuslog = function (err, data){
if(err)
{
log.ERROR.push(data)
}
else
{
log.SUCCESS.push(data)
}
}

module.exports = {
'log' : log
, 'statuslog' : statuslog
}

+ 15
- 0
result.js View File

var log = {
SUCCESS : []
, FAILURE : []
, SKIPPED : []
}

var statuslog = function (err, data){
if(err) log.FAILURE.push( {err, data} )
else log.SUCCESS.push(data)
}

module.exports = {
'log' : log
, 'statuslog' : statuslog
}

Loading…
Cancel
Save