Ver código fonte

sync master fixes

master
samuel 3 anos atrás
pai
commit
c75cff5236
1 arquivos alterados com 16 adições e 9 exclusões
  1. 16
    9
      index.js

+ 16
- 9
index.js Ver arquivo

@@ -66,12 +66,19 @@ var getTaskCheckExists = (command, options) => {
}
}

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

var pullCmd = [gitInstallDir
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: 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 : repo, title : 'pull all origins for ' + repo }]
}
else {
var pullCmd = [gitInstallDir
, ['-c', 'branch=`git rev-parse --abbrev-ref HEAD`;for i in `git remote`; do git pull $i $branch; done;']
, { cwd: repo, title: 'pull all origins for ' + repo }]
}
// var pullCmd = ['pullall', [], { cwd : repo }]
if (useGitPull) pullCmd = ['git', ['pull'], {
inherit: true, shell: true,
@@ -83,10 +90,10 @@ var getPullCmd = (repo) => {
return pullCmd
}

var performPull = (repo) => {
var performPull = (repo, branch) => {
if (existsSync(instanceroot + '/' + repo)) {
console.log('pulling ' + instanceroot + '/' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).then(() => {
console.log('pulling ' + instanceroot + '/' + repo + 'branch ' + branch)
return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
if (__isElevated) {
fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' })
}
@@ -636,9 +643,9 @@ var op = {
// console.dir(env)
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) {
return any(elevatedRunasRepos.map((repo) => performPull(repo))).then(() => {
return any(elevatedRunasRepos.map((repo) => performPull(repo, 'master'))).then(() => {
fs.writeFileSync('run.done', 'success')
}).catch(() => {
fs.writeFileSync('run.done', 'error')

Carregando…
Cancelar
Salvar