Ver código fonte

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

master
pb 3 anos atrás
pai
commit
0607f9c537
1 arquivos alterados com 24 adições e 11 exclusões
  1. 24
    11
      index.js

+ 24
- 11
index.js Ver arquivo

// Reset the whole installation pertaining to this elxr folder. // Reset the whole installation pertaining to this elxr folder.
} }
, 'add': (remotename, url, branch) => {
, 'remote add': (args) => {
// PB : TODO -- set-upstream-to should be chosen and intentionally switched. Coz we can have multiple upstream remotes. // PB : TODO -- set-upstream-to should be chosen and intentionally switched. Coz we can have multiple upstream remotes.
// Also each upstream remote may need to have is own branch to switch to. We therefore need a branch nomenclature // Also each upstream remote may need to have is own branch to switch to. We therefore need a branch nomenclature
// That explicitly has a remote name prefix. // That explicitly has a remote name prefix.
// probably git merge from all remotes... and relevant branches... // probably git merge from all remotes... and relevant branches...
// alias pushall='for i in `git remote`; do git push $i; done;' // alias pushall='for i in `git remote`; do git push $i; done;'
// alias pullall='for i in `git remote`; do git pull $i; done;' // alias pullall='for i in `git remote`; do git pull $i; done;'
// args === processedArgs ? args = {} : null;
var __args = {
remotename : args.remotename|| processedArgs._[2]
, url : args.url || processedArgs._[3]
, branch : args.branch || processedArgs._[4]
}
var remotename = __args.remotename
var url = __args.url
var branch = __args.branch

var pushable = processedArgs.pushable || false; var pushable = processedArgs.pushable || false;
remotename = remotename || processedArgs._[1]
url = url || processedArgs._[2]
branch = branch || processedArgs._[3]


var serial_perform_git_add = (repo) => { var serial_perform_git_add = (repo) => {
var options = { cwd: instanceroot + '/' + repo } var options = { cwd: instanceroot + '/' + repo }
// console.log(repo) // console.log(repo)
nodeShellExec('git', ['remote', 'get-url', remotename], { cwd: dir.name, stdio: 'ignore' }).then(() => { nodeShellExec('git', ['remote', 'get-url', remotename], { cwd: dir.name, stdio: 'ignore' }).then(() => {
console.log('skipped : ' + dir.name + ', reason : A remote with same name already exists.') console.log('skipped : ' + dir.name + ', reason : A remote with same name already exists.')
}) })
.catch((e) => {
any(serial_perform_git_add(dir.name).map(x))
})
.catch((e) => {
any(serial_perform_git_add(dir.name).map(x))
})
} }
// else console.log('Skipped : Not a Git Repo : ' + dir.name) // else console.log('Skipped : Not a Git Repo : ' + dir.name)
}).catch((e) => { }).catch((e) => {
// console.log('Failed : ' + dir.name)
console.log('Failed : ' + dir.name)
}) })
} }


const { readdir } = require("fs").promises const { readdir } = require("fs").promises
dirs(perform_git_add) dirs(perform_git_add)
} }
, 'remote remove': (args) => { , 'remote remove': (args) => {
// PB : TODO -- processedArgs should already be part of selected. // PB : TODO -- processedArgs should already be part of selected.
var instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName; var instanceName = processedArgs._[1] = processedArgs._[1] || chessinstances.current_run.instanceName || selected.instanceName;
var node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env; var node_env = processedArgs.node_env = processedArgs.node_env || chessinstances.current_run.node_env || selected.node_env;
chessinstances[instanceName] = chessinstances[instanceName] || {}
chessinstances[instanceName][node_env] = chessinstances[instanceName][node_env] || selected;
chessinstances['current_run'] = chessinstances[instanceName][selected.node_env] ? chessinstances['current_run'] = chessinstances[instanceName][selected.node_env] ?
{ instanceName: instanceName, node_env: node_env } : chessinstances['current_run']
// chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {}
{ instanceName: instanceName, node_env: node_env } : (chessinstances['current_run'] || { instanceName: instanceName, node_env: node_env })

// chessinstances[chessinstances.current_run.instanceName] = chessinstances[chessinstances.current_run.instanceName] || {}


if(path.normalize(selected.root) !== path.normalize(chessinstances[instanceName][node_env].root)) { if(path.normalize(selected.root) !== path.normalize(chessinstances[instanceName][node_env].root)) {
throw "Mismatched chessinstances config found " + chessinstances[instanceName][node_env].root + ' does not match ' + selected.root throw "Mismatched chessinstances config found " + chessinstances[instanceName][node_env].root + ' does not match ' + selected.root

Carregando…
Cancelar
Salvar