anish 3 anni fa
parent
commit
42097babbd
1 ha cambiato i file con 17 aggiunte e 9 eliminazioni
  1. 17
    9
      index.js

+ 17
- 9
index.js Vedi File

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

var getPullCmd = (repo) => {
var getPullCmd = (repo, branch) => {
// 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 }]
if (useGitPull) pullCmd = ['git', ['pull'], {
inherit: true, shell: true,
@@ -93,10 +100,11 @@ 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(() => {
var branchprint = branch ? ' branch :' + branch : '';
console.log('pulling ' + instanceroot + '/' + repo + branchprint )
return nodeShellExec.apply(null, getPullCmd(repo, branch)).then(() => {
if (__isElevated) {
fs.writeFileSync('run.log', ', ' + JSON.stringify({ repo, success: true }), { 'flag': 'a+' })
}
@@ -645,9 +653,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')

Loading…
Annulla
Salva