Browse Source

Miissing refactor for new repo manifest format

master
pb 3 years ago
parent
commit
24d266c59e
1 changed files with 18 additions and 18 deletions
  1. 18
    18
      index.js

+ 18
- 18
index.js View File

}) })
} }


var enqueueCheckout = function(def){ enqueue(elevatedqueue, performCheckout, def) }
var enqueueMerge = function(def){ enqueue(elevatedqueue, performMerge, def) }
// var enqueueCheckout = function(def){ enqueue(elevatedqueue, performCheckout, def) }
// var enqueueMerge = function(def){ enqueue(elevatedqueue, performMerge, def) }


var elevatedqueue = []; var elevatedqueue = [];
var enqueueOnce = (queue, task, def) => { var enqueueOnce = (queue, task, def) => {
} }
if (runconfig.NODE_ENV === 'development') performMerge = () => { return Promise.resolve(true) } if (runconfig.NODE_ENV === 'development') performMerge = () => { return Promise.resolve(true) }


var performRepoOperation = function(def) {
elevatedRunasRepos.map((repo) => enqueueCheckout({ repo, branch: def.branch, requiresElevation : true }))
return any(gitRepos.map((repo) => performCheckout({ repo, branch: def.branch})))
}
// var performRepoOperation = function(def) {
// elevatedRunasRepos.map((repo) => enqueueCheckout({ repo, branch: def.branch, requiresElevation : true }))
// return any(gitRepos.map((repo) => performCheckout({ repo, branch: def.branch})))
// }


return any(tasks).then(() => { return any(tasks).then(() => {
var pr = Promise.resolve(true) var pr = Promise.resolve(true)


//target is the env is we specify in elxr use command. Default is dev //target is the env is we specify in elxr use command. Default is dev
//Switch to target branch //Switch to target branch
return any(gitRepos.map((repo) => performCheckout({ repo, branch})))
return any(gitRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch})))
// pull or clone target branch // pull or clone target branch
.then(() => any(gitRepos.map((repo) => performPullAll({repo}))) )
.then(() => any(gitRepos.map((repo) => performPullAll(repo))) )
// switch to source branch // switch to source branch
.then( () => { .then( () => {
if(mergesource) return any(gitRepos.map((repo) => performCheckout({ repo, branch: mergesource})))
if(mergesource) return any(gitRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource})))
else return Promise.resolve(true) // Dont do anything if there is no source to merge from. else return Promise.resolve(true) // Dont do anything if there is no source to merge from.
}) })
//Pull on merge source branch //Pull on merge source branch
.then( () => { .then( () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(gitRepos.map((repo) => performPullAll({repo})))
return any(gitRepos.map((repo) => performPullAll(repo)))
}) })
//Switch to target branch //Switch to target branch
.then( () => { .then( () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch})))
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch})))
}) })
.then( //Merge source branch to target branch .then( //Merge source branch to target branch
() => { () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(gitRepos.map((repo) => performMerge({ repo }))).catch(err => { console.error('error in performMerge ' + err) })
return any(gitRepos.map((repo) => performMerge( repo ))).catch(err => { console.error('error in performMerge ' + err) })
}) })
}) })
} }
} }
return any(tasks).then(()=>{ return any(tasks).then(()=>{
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch, requiresElevation : true})))
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true})))
// pull or clone target branch // pull or clone target branch
.then( () => any(elevatedRunasRepos.map((repo) => performPullAll({repo}))) )
.then( () => any(elevatedRunasRepos.map((repo) => performPullAll(repo))) )
// switch to source branch // switch to source branch
.then( () => { .then( () => {
if(mergesource) return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch: mergesource, requiresElevation : true})))
if(mergesource) return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch: mergesource, requiresElevation : true})))
else return Promise.resolve(true) // Dont do anything if there is no source to merge from. else return Promise.resolve(true) // Dont do anything if there is no source to merge from.
}) })
//Pull on merge source branch //Pull on merge source branch
.then( () => { .then( () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(elevatedRunasRepos.map((repo) => performPullAll({repo, requiresElevation : true })))
return any(elevatedRunasRepos.map((repodef) => performPullAll({repo : repodef.repo, requiresElevation : true })))
}) })
//Switch to target branch //Switch to target branch
.then( () => { .then( () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(elevatedRunasRepos.map((repo) => performCheckout({ repo, branch, requiresElevation : true})))
return any(elevatedRunasRepos.map((repodef) => performCheckout({ repo : repodef.repo, branch, requiresElevation : true})))
}) })
.then( //Merge source branch to target branch .then( //Merge source branch to target branch
() => { () => {
if(!mergesource) return Promise.resolve(true) if(!mergesource) return Promise.resolve(true)
return any(elevatedRunasRepos.map((repo) => performMerge({ repo, requiresElevation : true }))).catch(err => { console.error('error in performMerge ' + err) })
return any(elevatedRunasRepos.map((repodef) => performMerge({ repo : repodef.repo, requiresElevation : true }))).catch(err => { console.error('error in performMerge ' + err) })
}) })
.then(() => { .then(() => {
fs.writeFileSync('run.done', 'success') fs.writeFileSync('run.done', 'success')

Loading…
Cancel
Save