소스 검색

elxr errors and new repo

master
Pradeep Bhaskaran 3 년 전
부모
커밋
344170c15a
2개의 변경된 파일57개의 추가작업 그리고 5개의 파일을 삭제
  1. 54
    5
      index.js
  2. 3
    0
      windowselevate.hta

+ 54
- 5
index.js 파일 보기

@@ -28,10 +28,11 @@ const { isMaster } = require('cluster');

// Default Config...
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 defaultRepoOwner = 'chess';
@@ -453,6 +454,48 @@ var __runcmd = function(label){
, 'is-git-repo' : (dir)=>{
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) => {
var pushable = processedArgs.pushable || false;
remotename = remotename || processedArgs._[1]
@@ -719,10 +762,13 @@ var __runcmd = function(label){
return pullCmd
}

var errors = [];
var performPull = (repo) => {
if(existsSync(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 {
console.log('cloning ' + repo)
@@ -732,7 +778,10 @@ var __runcmd = function(label){
inherit : true, shell: true,
env: process.env
, 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],
{

+ 3
- 0
windowselevate.hta 파일 보기

@@ -38,7 +38,10 @@
var cargs = (processedArgs.debug ? '--inspect-brk=9228' : '') + ' elxr ' + processedArgs._.join(' ') + ' ' + namedArgs.join(' ');
// alert(cargs)
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(processedArgs['nodepath'], cargs, '', 'runas', 1);
var fso = new ActiveXObject('Scripting.FileSystemObject');
window.onload = function() {

Loading…
취소
저장