Browse Source

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

production
anish 3 years ago
parent
commit
42097babbd
1 changed files with 17 additions and 9 deletions
  1. 17
    9
      index.js

+ 17
- 9
index.js View File

} }
} }


var getPullCmd = (repo) => {
var getPullCmd = (repo, branch) => {
// console.log(useGitPull) // console.log(useGitPull)


var pullCmd = [gitbash
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo }]
if(branch) {
var pullCmd = [ gitInstallDir
, ['-c', 'for i in `git remote`; do git pull $i ' + branch + '; done;']
, { cwd: instanceroot + '/' + repo, title : 'pull all origins for ' + repo }]
}
else {
var pullCmd = [gitbash
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: instanceroot + '/' + repo, title: 'pull all origins for ' + repo }]
}
// var pullCmd = ['pullall', [], { cwd : repo }] // var pullCmd = ['pullall', [], { cwd : repo }]
if (useGitPull) pullCmd = ['git', ['pull'], { if (useGitPull) pullCmd = ['git', ['pull'], {
inherit: true, shell: true, inherit: true, shell: true,
return pullCmd return pullCmd
} }


var performPull = (repo) => {
var performPull = (repo, branch) => {
if (existsSync(instanceroot + '/' + repo)) { if (existsSync(instanceroot + '/' + repo)) {
console.log('pulling ' + instanceroot + '/' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).then(() => {
var branchprint = branch ? ' branch :' + branch : '';
console.log('pulling ' + instanceroot + '/' + repo + branchprint )
return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
if (__isElevated) { if (__isElevated) {
fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' }) fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' })
} }
// console.dir(env) // console.dir(env)
console.log('Running exlr pull : ' + path.dirname(__dirname)) console.log('Running exlr pull : ' + path.dirname(__dirname))


if (!processedArgs.runas) gitRepos.forEach(performPull)
if (!processedArgs.runas) gitRepos.map((repo) => performPull(repo, 'master'))
if (__isElevated) { if (__isElevated) {
return any(elevatedRunasRepos.map((repo) => performPull(repo))).then(() => {
return any(elevatedRunasRepos.map((repo) => performPull(repo, 'master'))).then(() => {
fs.writeFileSync('run.done', 'success') fs.writeFileSync('run.done', 'success')
}).catch(() => { }).catch(() => {
fs.writeFileSync('run.done', 'error') fs.writeFileSync('run.done', 'error')

Loading…
Cancel
Save