ソースを参照

elxr errors and new repo

production
Pradeep Bhaskaran 3年前
コミット
344170c15a
2個のファイルの変更57行の追加5行の削除
  1. 54
    5
      index.js
  2. 3
    0
      windowselevate.hta

+ 54
- 5
index.js ファイルの表示



// Default Config... // Default Config...
var reposervers = [ var reposervers = [
'http://git.bbh'
, '//172.16.0.27/repos'
'http://git.bbh'
, 'https://git.bbh.org.in'
, '//172.16.0.27/repos'
] ]
var defaultRepoServer = reposervers[0]
var defaultRepoServer = reposervers[1]


var currentGitAuthUser ; // nodeShellExec('git', ['config', 'user.email']) ... PB : TODO-- get the current gittea username var currentGitAuthUser ; // nodeShellExec('git', ['config', 'user.email']) ... PB : TODO-- get the current gittea username
var defaultRepoOwner = 'chess'; var defaultRepoOwner = 'chess';
, 'is-git-repo' : (dir)=>{ , 'is-git-repo' : (dir)=>{
return nodeShellExec('git', ['-C', dir.name, 'rev-parse'], { stdio : 'ignore'}) return nodeShellExec('git', ['-C', dir.name, 'rev-parse'], { stdio : 'ignore'})
} }
, 'set-url' : (remotename, url) => {
var pushable = processedArgs.pushable || false;
remotename = remotename || processedArgs._[1]
url = url || processedArgs._[2]
var serial_perform_git_seturl = (repo)=>{
var options = { cwd : repo }
// console.log(repo)
if(pushable) {
return [
['git', ['remote', 'set-url', remotename, url + '/' + repo], { cwd : repo }]
]
}
else {
console.error('not supported for non-pushable')
}

}
var x = (args)=>{
return ()=>{
// console.log(args)
return nodeShellExec.apply(null, args)
}
// return Promise.resolve(true)
}
var perform_git_seturl = (dir)=>{
op['is-git-repo'](dir).then((code)=>{
any( serial_perform_git_seturl(dir.name).map(x) )
}).catch((e)=>{
// console.log('Failed : ' + dir.name)
})
}

const { readdir } = require("fs").promises

const dirs = async (perform, path) => {
for (const dir of await readdir(path || process.cwd(), { withFileTypes: true })) {
if (dir.isDirectory()) perform(dir)
}
}

dirs( perform_git_seturl)
}
, 'add' : (remotename, url, branch) => { , 'add' : (remotename, url, branch) => {
var pushable = processedArgs.pushable || false; var pushable = processedArgs.pushable || false;
remotename = remotename || processedArgs._[1] remotename = remotename || processedArgs._[1]
return pullCmd return pullCmd
} }


var errors = [];
var performPull = (repo) => { var performPull = (repo) => {
if(existsSync(repo)) { if(existsSync(repo)) {
console.log('pulling ' + repo) console.log('pulling ' + repo)
return nodeShellExec.apply(null, getPullCmd(repo)).catch((e)=>{ console.error(e) })
return nodeShellExec.apply(null, getPullCmd(repo)).catch((e)=>{
errors.push({ repo , e})
console.error(e) })
} }
else { else {
console.log('cloning ' + repo) console.log('cloning ' + repo)
inherit : true, shell: true, inherit : true, shell: true,
env: process.env env: process.env
, runas : processedArgs.runas , runas : processedArgs.runas
}).catch((e)=>{ console.error(e) }).then(()=>{
}).catch((e)=>{
errors.push({ repo , e})
console.error(e)
}).then(()=>{


return nodeShellExec('git', ['config', '--replace-all' , 'core.symlinks', true], return nodeShellExec('git', ['config', '--replace-all' , 'core.symlinks', true],
{ {

+ 3
- 0
windowselevate.hta ファイルの表示

var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' elxr ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' '); var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' elxr ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' ');
// alert(cargs) // alert(cargs)
var shell = new ActiveXObject('shell.application'); var shell = new ActiveXObject('shell.application');
// alert('launching node privilged. ' + processedArgs['nodepath'])
// shell.ShellExecute('where', 'node', '', '', 10);
shell.ShellExecute('node', cargs, '', 'runas', 1); shell.ShellExecute('node', cargs, '', 'runas', 1);
// shell.ShellExecute(processedArgs['nodepath'], cargs, '', 'runas', 1);
var fso = new ActiveXObject('Scripting.FileSystemObject'); var fso = new ActiveXObject('Scripting.FileSystemObject');
window.onload = function() { window.onload = function() {

読み込み中…
キャンセル
保存