|
|
|
|
|
|
|
|
var statuslog = utils.Traq |
|
|
var statuslog = utils.Traq |
|
|
var Traq = utils.Traq |
|
|
var Traq = utils.Traq |
|
|
// console.error('EEEEEEEEEEEEEEEEEEEE') |
|
|
// console.error('EEEEEEEEEEEEEEEEEEEE') |
|
|
|
|
|
|
|
|
|
|
|
var util = require('util') |
|
|
|
|
|
|
|
|
var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns. |
|
|
var ENV = Object.assign({}, process.env); // Shallow clone so we can set values and reuse for reshelling spawns. |
|
|
const cliargs = utils.cliargs; |
|
|
const cliargs = utils.cliargs; |
|
|
|
|
|
|
|
|
// wd is our own environment variable probably corresponding to the root but need not be the same. |
|
|
// wd is our own environment variable probably corresponding to the root but need not be the same. |
|
|
// console.log(processedArgs.root) |
|
|
// console.log(processedArgs.root) |
|
|
|
|
|
|
|
|
|
|
|
// console.log('PWD :' + ENV.PWD) |
|
|
|
|
|
// console.log('cwd : ' + process.cwd()) |
|
|
|
|
|
// console.log('launchscriptdir : ' + path.normalize(__dirname)) |
|
|
|
|
|
|
|
|
if(!processedArgs.root){ |
|
|
if(!processedArgs.root){ |
|
|
if(!process.env.wd){ |
|
|
if(!process.env.wd){ |
|
|
console.log('discovery') |
|
|
console.log('discovery') |
|
|
|
|
|
|
|
|
, noprerequisites : true |
|
|
, noprerequisites : true |
|
|
, independentcmd : true |
|
|
, independentcmd : true |
|
|
// , requires : [ generateDependencies ] |
|
|
// , requires : [ generateDependencies ] |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
, 'remote add' : { |
|
|
, 'remote add' : { |
|
|
// return a interpreted set of arguments for this cmd run context. |
|
|
// return a interpreted set of arguments for this cmd run context. |
|
|
|
|
|
|
|
|
var repodef = selectedinstance.reposindexed[repo]; |
|
|
var repodef = selectedinstance.reposindexed[repo]; |
|
|
if(!repodef) return |
|
|
if(!repodef) return |
|
|
|
|
|
|
|
|
var remotenames = (selectedinstance.selectedremotes || []).concat( selectedinstance.permanentremotes ) |
|
|
|
|
|
|
|
|
var remotenames = selectedinstance.selectedremotes.concat( selectedinstance.permanentremotes ) |
|
|
var remotes = selectedinstance.reposerverinstances[selectedinstance.reposerver].remotes |
|
|
var remotes = selectedinstance.reposerverinstances[selectedinstance.reposerver].remotes |
|
|
// console.log('-----------------------------------------------------') |
|
|
// console.log('-----------------------------------------------------') |
|
|
// console.log(repo) |
|
|
// console.log(repo) |
|
|
|
|
|
|
|
|
var interpretrun = function(){ |
|
|
var interpretrun = function(){ |
|
|
var cmd = processedArgs._[0]; |
|
|
var cmd = processedArgs._[0]; |
|
|
return cmds[cmd] && cmds[cmd].interpret ? cmds[cmd].interpret() : (function(){ |
|
|
return cmds[cmd] && cmds[cmd].interpret ? cmds[cmd].interpret() : (function(){ |
|
|
return cmds[cmd] = utils.assign(cmds[cmd], interpret.call({ cmd, toArgs : function( o ){ |
|
|
|
|
|
|
|
|
return cmds[cmd] = utils.assign(cmds[cmd] || {}, interpret.call({ cmd, toArgs : function( o ){ |
|
|
// PB : TODO -- need to call this before selectedinstance is built. The instanceName is dependent on the specific cmd. |
|
|
// PB : TODO -- need to call this before selectedinstance is built. The instanceName is dependent on the specific cmd. |
|
|
return o } })) |
|
|
return o } })) |
|
|
})() |
|
|
})() |
|
|
|
|
|
|
|
|
if(repo === '.elxr') return Promise.resolve(true) |
|
|
if(repo === '.elxr') return Promise.resolve(true) |
|
|
if(repo === '.git') return Promise.resolve(true) |
|
|
if(repo === '.git') return Promise.resolve(true) |
|
|
if(repo === 'Downloads') return Promise.resolve(true) |
|
|
if(repo === 'Downloads') return Promise.resolve(true) |
|
|
// if(repo !== 'elixir-config-development') { |
|
|
|
|
|
|
|
|
|
|
|
// PB : TODO -- pick up remote definitions per repository... |
|
|
|
|
|
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } |
|
|
|
|
|
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo |
|
|
|
|
|
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName |
|
|
|
|
|
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver } |
|
|
|
|
|
)) |
|
|
|
|
|
// } |
|
|
|
|
|
// else { |
|
|
|
|
|
// var reposmanfiest= { error : 'Already lodeded elixir-config-development'} |
|
|
|
|
|
// } |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PB : TODO -- pick up remote definitions per repository... |
|
|
|
|
|
var reposmanfiest = utils.assign_core( { keycase : true, arraymergetype : utils.assign_core.DISTINCT_UNION } |
|
|
|
|
|
, {}, selectedinstance, loadmanifest( selectedinstance.root + '/' + repo |
|
|
|
|
|
, { utils, username : selectedinstance.username, instanceName : selectedinstance.instanceName |
|
|
|
|
|
, node_env : selectedinstance.node_env, reposerver : selectedinstance.reposerver } |
|
|
|
|
|
)) |
|
|
|
|
|
|
|
|
if( !reposmanfiest.error ) { |
|
|
if( !reposmanfiest.error ) { |
|
|
var reporemotenames = remotenames.concat(reposmanfiest.selectedremotes || []).concat( reposmanfiest.permanentremotes || [] ) |
|
|
var reporemotenames = remotenames.concat(reposmanfiest.selectedremotes || []).concat( reposmanfiest.permanentremotes || [] ) |
|
|
|
|
|
|
|
|
var regularpulltasks = function(){ |
|
|
var regularpulltasks = function(){ |
|
|
var pendingpulls = []; |
|
|
var pendingpulls = []; |
|
|
def.repos.forEach((def) => { |
|
|
def.repos.forEach((def) => { |
|
|
pendingpulls.push( |
|
|
|
|
|
performPull(def).then(()=>{ console.log('pulled ' + JSON.stringify(def.repo)) }) |
|
|
|
|
|
.catch(e => { console.log(e); throw e }) |
|
|
|
|
|
|
|
|
pendingpulls.push( |
|
|
|
|
|
function(){ |
|
|
|
|
|
// if(def.repo === 'setup') return; |
|
|
|
|
|
// if(def.repo !== 'chess-client-lib') return; |
|
|
|
|
|
|
|
|
|
|
|
return performPull(def).then(()=>{ console.log('pulled ' + JSON.stringify(def.repo)) }) |
|
|
|
|
|
.catch(e => { |
|
|
|
|
|
console.error(util.inspect(e)); throw e }) |
|
|
|
|
|
} |
|
|
) |
|
|
) |
|
|
}) |
|
|
}) |
|
|
return any(pendingpulls).finally(Traq.finally) |
|
|
return any(pendingpulls).finally(Traq.finally) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function resetgitconfig(){ |
|
|
function resetgitconfig(){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// https://stackoverflow.com/questions/37182847/how-do-i-disable-git-credential-manager-for-windows |
|
|
|
|
|
// use git config --edit --system to remove the helper = manager line so that it is no longer registered as a credential helper. |
|
|
|
|
|
// For bonus points, use git config --edit --global and insert: |
|
|
|
|
|
// [core] |
|
|
|
|
|
// askpass = |
|
|
|
|
|
|
|
|
// https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage |
|
|
// https://git-scm.com/book/en/v2/Git-Tools-Credential-Storage |
|
|
// Git Credential storage... |
|
|
// Git Credential storage... |
|
|
// git config --global credential.helper 'store --file ~/.gitcredentials' |
|
|
|
|
|
|
|
|
// git config --global credential.helper 'store --file ~/.elxrcredentials' |
|
|
// git credential fill |
|
|
// git credential fill |
|
|
// protocol=https |
|
|
// protocol=https |
|
|
// host=git.bbh.org.in |
|
|
// host=git.bbh.org.in |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
}) |
|
|
}) |
|
|
.catch((e)=>{ |
|
|
.catch((e)=>{ |
|
|
console.log(e) |
|
|
|
|
|
|
|
|
console.error(e) |
|
|
return __onResult(e) |
|
|
return __onResult(e) |
|
|
}) |
|
|
}) |
|
|
} |
|
|
} |