|  |  | @@ -358,10 +358,24 @@ var getPullCmd = (repo, branch) => { | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | // PB : TODO -- Use queueing with async tasks.. | 
		
	
		
			
			|  |  |  | var performPull = (repodef, branch, repoowner, errHandler) => { | 
		
	
		
			
			|  |  |  | var performPull = (repodef, branch, repoowner, errHandler, elevatedBatch, regularBatch) => { | 
		
	
		
			
			|  |  |  | var __inelevatedBatch = elevatedBatch, __inregularBatch = regularBatch; | 
		
	
		
			
			|  |  |  | var pT = getPullTask(repodef, branch, repoowner, errHandler, elevatedBatch, regularBatch) | 
		
	
		
			
			|  |  |  | // var waitForBatchAdditions = function(){ | 
		
	
		
			
			|  |  |  | //   return pT; | 
		
	
		
			
			|  |  |  | // } | 
		
	
		
			
			|  |  |  | // Execute is implied. | 
		
	
		
			
			|  |  |  | // if(false && (__inelevatedBatch || __inregularBatch) ) return waitForBatchAdditions()  // PB : Todo Implemnt a trigger which starts execution. | 
		
	
		
			
			|  |  |  | // else | 
		
	
		
			
			|  |  |  | return pT()  // Execute it. | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | var getPullTask = (repodef, branch, repoowner, errHandler, elevatedBatch, regularBatch) => { | 
		
	
		
			
			|  |  |  | // PB : TODO -- Handle no branch passed in case. | 
		
	
		
			
			|  |  |  | // if(!branch) { throw 'No branch specified' } | 
		
	
		
			
			|  |  |  | var repo = repodef.repo; | 
		
	
		
			
			|  |  |  | elevatedBatch = elevatedBatch || []; | 
		
	
		
			
			|  |  |  | regularBatch = regularBatch || []; | 
		
	
		
			
			|  |  |  | try{ | 
		
	
		
			
			|  |  |  | var exists = existsSync(instanceroot + '/' + repo) | 
		
	
		
			
			|  |  |  | } | 
		
	
	
		
			
			|  |  | @@ -370,6 +384,24 @@ var performPull = (repodef, branch, repoowner, errHandler) => { | 
		
	
		
			
			|  |  |  | console.log(e) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | function initTask(etask){ | 
		
	
		
			
			|  |  |  | etask.info = { repo } | 
		
	
		
			
			|  |  |  | etask.errHandler = errHandler | 
		
	
		
			
			|  |  |  | etask.statuslog = statuslog | 
		
	
		
			
			|  |  |  | etask.processedArgs = processedArgs | 
		
	
		
			
			|  |  |  | etask.selectedinstance = selectedinstance | 
		
	
		
			
			|  |  |  | etask.runtimestamp = runtimestamp | 
		
	
		
			
			|  |  |  | etask.ENV = ENV | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | elevatedBatch.info = { repo } | 
		
	
		
			
			|  |  |  | elevatedBatch.errHandler = errHandler | 
		
	
		
			
			|  |  |  | elevatedBatch.statuslog = statuslog | 
		
	
		
			
			|  |  |  | elevatedBatch.processedArgs = processedArgs | 
		
	
		
			
			|  |  |  | elevatedBatch.selectedinstance = selectedinstance | 
		
	
		
			
			|  |  |  | elevatedBatch.runtimestamp = runtimestamp | 
		
	
		
			
			|  |  |  | elevatedBatch.ENV = ENV | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | if (exists) { | 
		
	
		
			
			|  |  |  | var branchprint =  branch ? ' branch :' + branch  : ''; | 
		
	
		
			
			|  |  |  | console.log('pulling ' + instanceroot + '/' + repo + branchprint ) | 
		
	
	
		
			
			|  |  | @@ -378,20 +410,21 @@ var performPull = (repodef, branch, repoowner, errHandler) => { | 
		
	
		
			
			|  |  |  | return true; | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | initTask(task) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | task.info = { repo } | 
		
	
		
			
			|  |  |  | task.errHandler = errHandler | 
		
	
		
			
			|  |  |  | task.statuslog = statuslog | 
		
	
		
			
			|  |  |  | task.processedArgs = processedArgs | 
		
	
		
			
			|  |  |  | task.selectedinstance = selectedinstance | 
		
	
		
			
			|  |  |  | task.runtimestamp = runtimestamp | 
		
	
		
			
			|  |  |  | task.ENV = ENV | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) return shell_verse.runElevated( task ) | 
		
	
		
			
			|  |  |  | else return shell_verse.runTask( task ) | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) { | 
		
	
		
			
			|  |  |  | elevatedBatch.push(shell_verse.getElevatedTask( task )); | 
		
	
		
			
			|  |  |  | return elevatedBatch[elevatedBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | regularBatch.push(shell_verse.getNonElevatedTask( task )) | 
		
	
		
			
			|  |  |  | return regularBatch[regularBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | console.log('cloning ' + repo) | 
		
	
		
			
			|  |  |  | // PB : TODO -- detect if a clonable repo exists in currentGitAuthUser | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | var task = ()=>{ | 
		
	
		
			
			|  |  |  | return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', selectedinstance.reposerver + `/${repoowner || defaultRepoOwner}/` + repo + '.git'], | 
		
	
		
			
			|  |  |  | { | 
		
	
	
		
			
			|  |  | @@ -411,27 +444,29 @@ var performPull = (repodef, branch, repoowner, errHandler) => { | 
		
	
		
			
			|  |  |  | , title: `'git', ${['config', '--replace-all', 'core.symlinks', selectedinstance.username].join(' ')}` | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | task.info = { repo } | 
		
	
		
			
			|  |  |  | task.errHandler = errHandler | 
		
	
		
			
			|  |  |  | task.statuslog = statuslog | 
		
	
		
			
			|  |  |  | task.processedArgs = processedArgs | 
		
	
		
			
			|  |  |  | task.selectedinstance = selectedinstance | 
		
	
		
			
			|  |  |  | task.runtimestamp = runtimestamp | 
		
	
		
			
			|  |  |  | task.ENV = ENV | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) return shell_verse.runElevated( task ) | 
		
	
		
			
			|  |  |  | else return shell_verse.runTask( task ) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | initTask(task) | 
		
	
		
			
			|  |  |  | 
 | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) { | 
		
	
		
			
			|  |  |  | elevatedBatch.push(shell_verse.getElevatedTask( task )); | 
		
	
		
			
			|  |  |  | return elevatedBatch[elevatedBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | regularBatch.push(shell_verse.getNonElevatedTask( task )) | 
		
	
		
			
			|  |  |  | return regularBatch[regularBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | }) | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  |  | 
		
	
		
			
			|  |  |  | initTask(task) | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) { | 
		
	
		
			
			|  |  |  | elevatedBatch.push(shell_verse.getElevatedTask( task )); | 
		
	
		
			
			|  |  |  | return elevatedBatch[elevatedBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | else { | 
		
	
		
			
			|  |  |  | regularBatch.push(shell_verse.getNonElevatedTask( task )) | 
		
	
		
			
			|  |  |  | return regularBatch[regularBatch.length-1] | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | task.info = { repo } | 
		
	
		
			
			|  |  |  | task.errHandler = errHandler | 
		
	
		
			
			|  |  |  | task.statuslog = statuslog | 
		
	
		
			
			|  |  |  | task.processedArgs = processedArgs | 
		
	
		
			
			|  |  |  | task.selectedinstance = selectedinstance | 
		
	
		
			
			|  |  |  | task.runtimestamp = runtimestamp | 
		
	
		
			
			|  |  |  | task.ENV = ENV | 
		
	
		
			
			|  |  |  | if(repodef.requiresElevation) return shell_verse.runElevated( task ) | 
		
	
		
			
			|  |  |  | else return shell_verse.runTask( task ) | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | } | 
		
	
		
			
			|  |  |  | 
 | 
		
	
	
		
			
			|  |  | @@ -2287,7 +2322,6 @@ var elxr = { | 
		
	
		
			
			|  |  |  | if(def.repo) { | 
		
	
		
			
			|  |  |  | // Single repo case. | 
		
	
		
			
			|  |  |  | if(def.repo.requiresElevation) { | 
		
	
		
			
			|  |  |  | getElevatedTask | 
		
	
		
			
			|  |  |  | var t1 = function() { | 
		
	
		
			
			|  |  |  | return performPull(def).then(() => { | 
		
	
		
			
			|  |  |  | return true; | 
		
	
	
		
			
			|  |  | @@ -2337,7 +2371,9 @@ var elxr = { | 
		
	
		
			
			|  |  |  | if(def.elevated){ | 
		
	
		
			
			|  |  |  | elevatedpulltasks = function() { | 
		
	
		
			
			|  |  |  | // shell_verse.getElevatedTask( t1 ) | 
		
	
		
			
			|  |  |  | return any(def.elevated.map((def) => performPull(def))).then(() => { | 
		
	
		
			
			|  |  |  | var eBatch = [] | 
		
	
		
			
			|  |  |  | def.elevated.map((def) => getPullTask(def, null, null, null, eBatch)) | 
		
	
		
			
			|  |  |  | return shell_verse.runElevated(eBatch).then(() => { | 
		
	
		
			
			|  |  |  | return true; | 
		
	
		
			
			|  |  |  | }).catch((e) => { | 
		
	
		
			
			|  |  |  | console.error(e) |