Browse Source

Merge branch 'master' of https://git.bbh.org.in/chess/elxr into master

master
Pradeep Bhaskaran 3 years ago
parent
commit
6fa751492e
2 changed files with 34 additions and 7 deletions
  1. 12
    7
      index.js
  2. 22
    0
      repolog.js

+ 12
- 7
index.js View File


var repolog = require('./repolog')
// 'use strict'; // 'use strict';


// PB : TODO -- make sure folder context is proper coz we can now run elxr from anywhere. // PB : TODO -- make sure folder context is proper coz we can now run elxr from anywhere.
var performPull = (repo) => { var performPull = (repo) => {
if(existsSync(repo)) { if(existsSync(repo)) {
console.log('pulling ' + repo) console.log('pulling ' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).catch((e)=>{
errors.push({ repo , e})
console.error(e) })
return nodeShellExec.apply(null, getPullCmd(repo)).then((srepo)=>{
repolog.statuslog(null, srepo)}).catch((e)=>{ console.error(e) })
} }
else { else {
console.log('cloning ' + repo)
// PB : TODO -- detect if a clonable repo exists in currentGitAuthUser // PB : TODO -- detect if a clonable repo exists in currentGitAuthUser
return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', defaultRepoServer + `/${defaultRepoOwner}/` + repo + '.git'], return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', defaultRepoServer + `/${defaultRepoOwner}/` + repo + '.git'],
{ {
} }
} }


if(!processedArgs.runas) gitRepos.forEach(performPull)
if(!processedArgs.runas) {
var pendingpulls = [];
gitRepos.forEach( (r)=>{
pendingpulls.push(performPull(r))
} )
Promise.all(pendingpulls).then(results =>{
console.log(repolog.log.SUCCESS)
})
}
return isRunningElevated().then( return isRunningElevated().then(
(isElevated) => { (isElevated) => {
if(isElevated) { if(isElevated) {
p.process = child; p.process = child;
return p; return p;
} }


+ 22
- 0
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
}

Loading…
Cancel
Save