|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var repolog = require('./repolog') |
|
|
|
|
|
var path = require('path'); |
|
|
|
|
|
var utils = require('bbhverse'); |
|
|
|
|
|
var any = utils.any; |
|
|
// 'use strict'; |
|
|
// 'use strict'; |
|
|
|
|
|
|
|
|
// PB : TODO -- make sure folder context is proper coz we can now run elxr from anywhere. |
|
|
// PB : TODO -- make sure folder context is proper coz we can now run elxr from anywhere. |
|
|
|
|
|
|
|
|
const { existsSync } = require('fs'); |
|
|
const { existsSync } = require('fs'); |
|
|
const fs = require('fs') |
|
|
const fs = require('fs') |
|
|
const { spawn, spawnSync } = require('child_process'); |
|
|
const { spawn, spawnSync } = require('child_process'); |
|
|
const cliargs = require('../elxr/cliargs'); // Use minimist... |
|
|
|
|
|
|
|
|
const cliargs = utils.cliargs; |
|
|
const processedArgs = cliargs(process.argv.slice(2)); |
|
|
const processedArgs = cliargs(process.argv.slice(2)); |
|
|
console.dir(processedArgs) |
|
|
console.dir(processedArgs) |
|
|
var globSync = require('glob').sync; |
|
|
var globSync = require('glob').sync; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 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[0] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// PB : TODO -- If we are run from an elevated shell it never moves forward and simply exits. |
|
|
// PB : TODO -- If we are run from an elevated shell it never moves forward and simply exits. |
|
|
// -- Currently workaround is to always run from a non-elevated shell. |
|
|
// -- Currently workaround is to always run from a non-elevated shell. |
|
|
|
|
|
|
|
|
// Serialize a set of functions that will execute to return a promises one after the other. |
|
|
|
|
|
// Will stop when any one fails unless continueOnFailure is true. |
|
|
|
|
|
// All tasks in iterables can be functions or promises. |
|
|
|
|
|
// promises as usual can return other promises or resolve to either truthy or falsy values. |
|
|
|
|
|
// functions must return a promise |
|
|
|
|
|
function any(iterable, continueOnFailure) { |
|
|
|
|
|
return iterable.reduce( |
|
|
|
|
|
(p, fn, i ,a) => { |
|
|
|
|
|
// console.log('accumulator :'); |
|
|
|
|
|
// console.log(p); |
|
|
|
|
|
if(Promise.resolve(p) === p ) { |
|
|
|
|
|
return p.then((pVal) => { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Falsy values are task failure. |
|
|
|
|
|
if(!pVal) { |
|
|
|
|
|
console.warn('Possible failure for result : ' + pVal) |
|
|
|
|
|
console.warn(a[i-1]) |
|
|
|
|
|
fn ? console.error("Fn : " + fn.toString()) : null; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Truthy values are failures if obj has error=true. |
|
|
|
|
|
if(pVal && pVal.error) { console.error('Failed : ' + pVal.message + ' ' + pVal) } |
|
|
|
|
|
|
|
|
|
|
|
if(Promise.resolve(pVal) === pVal) { |
|
|
|
|
|
// Passed in function retured a promise. We still need to wait for it. |
|
|
|
|
|
pVal.then((pVal)=>{ |
|
|
|
|
|
|
|
|
|
|
|
// console.log('Then --pVal = ' + pVal + ' bContinue = ' + continueOnFailure ); console.log(p); |
|
|
|
|
|
if(!pVal && !continueOnFailure) { |
|
|
|
|
|
console.error(`E1 : i = ${i} : pVal :` + pVal); |
|
|
|
|
|
console.error('debugData 2 -------------------'); |
|
|
|
|
|
|
|
|
|
|
|
console.log("Cancelling remaining..."); |
|
|
|
|
|
throw 'Failed in reduce 1 ' |
|
|
|
|
|
} |
|
|
|
|
|
if(!fn && !continueOnFailure) { console.error('Error : No task specified.'); throw false;} |
|
|
|
|
|
else if(!fn) return false; |
|
|
|
|
|
return (Promise.resolve(fn) === fn ) ? fn : fn() ; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
|
|
|
|
|
|
// We will stop on null resolved values on any one task unless continueOnFailure is true. |
|
|
|
|
|
// console.log('Then --pVal = ' + pVal + ' bContinue = ' + continueOnFailure ); console.log(p); |
|
|
|
|
|
if(!pVal && !continueOnFailure) { |
|
|
|
|
|
console.error(`E2 : i = ${i} : pVal :` + pVal); |
|
|
|
|
|
console.error('debugData 2 -------------------'); |
|
|
|
|
|
|
|
|
|
|
|
console.log("Cancelling remaining..."); |
|
|
|
|
|
throw 'Failed in reduce 2 ' |
|
|
|
|
|
} |
|
|
|
|
|
if(!fn && !continueOnFailure) { console.error('Error : No task specified.'); throw false;} |
|
|
|
|
|
else if(!fn) return false; |
|
|
|
|
|
return (Promise.resolve(fn) === fn ) ? fn : fn() ; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}).catch((error) => { |
|
|
|
|
|
console.error(`E3 : i = ${i} `); |
|
|
|
|
|
fn ? console.error("Fn : " + fn.toString()) : null; |
|
|
|
|
|
console.error('debugData 3-------------------------'); |
|
|
|
|
|
|
|
|
|
|
|
throw 'Failed in reduce 3 ' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
else if(!p) { |
|
|
|
|
|
console.log("Bypass on failure"); |
|
|
|
|
|
return false; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
, Promise.resolve(true) |
|
|
|
|
|
); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var __isElevated = null; |
|
|
var __isElevated = null; |
|
|
var isRunningElevated = ()=>{ |
|
|
var isRunningElevated = ()=>{ |
|
|
if(__isElevated === null) { |
|
|
if(__isElevated === null) { |
|
|
|
|
|
|
|
|
, 'loopback-jsonapi-model-serializer' |
|
|
, 'loopback-jsonapi-model-serializer' |
|
|
, 'elixir-config-development' |
|
|
, 'elixir-config-development' |
|
|
, 'elixir-config-test' |
|
|
, 'elixir-config-test' |
|
|
, 'cihsr-config' |
|
|
|
|
|
|
|
|
, 'cihsr-config-development' |
|
|
, 'cihsr-data' |
|
|
, 'cihsr-data' |
|
|
, 'elixir-data' |
|
|
, 'elixir-data' |
|
|
, 'loopback-connector-ds' |
|
|
, 'loopback-connector-ds' |
|
|
|
|
|
|
|
|
var productionRepos = [ |
|
|
var productionRepos = [ |
|
|
'elixir-config-production' |
|
|
'elixir-config-production' |
|
|
] |
|
|
] |
|
|
var productionIsAllowed = true; |
|
|
|
|
|
|
|
|
var productionIsAllowed = (process.env.NODE_ENV === 'production'); |
|
|
if(productionIsAllowed) gitRepos = gitRepos.concat(productionRepos) |
|
|
if(productionIsAllowed) gitRepos = gitRepos.concat(productionRepos) |
|
|
|
|
|
|
|
|
var env = Object.assign({}, process.env); // Shallow clone it. |
|
|
var env = Object.assign({}, process.env); // Shallow clone it. |
|
|
|
|
|
|
|
|
, '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] |
|
|
|
|
|
|
|
|
var options = { cwd : repo } |
|
|
var options = { cwd : repo } |
|
|
// console.log(repo) |
|
|
// console.log(repo) |
|
|
return [ |
|
|
return [ |
|
|
['git', ['remote', 'add', 'chess', 'http://git.bbh/chess/elxr.git'], { cwd : repo }] |
|
|
|
|
|
|
|
|
['git', ['remote', 'add', 'chess', `${defaultRepoServer}/${user}/${repo}.git`], { cwd : repo }] |
|
|
, ['git', ['remote', 'set-url', '--push', 'chess', 'no-pushing'], { cwd : repo }] |
|
|
, ['git', ['remote', 'set-url', '--push', 'chess', 'no-pushing'], { cwd : repo }] |
|
|
, ['git', ['remote', 'set-url', 'origin', `http://git.bbh/${user}/${repo}.git`], { cwd : repo }] |
|
|
|
|
|
|
|
|
, ['git', ['remote', 'set-url', 'origin', `${defaultRepoServer}/${user}/${repo}.git`], { cwd : repo }] |
|
|
]} |
|
|
]} |
|
|
var x = (args)=>{ |
|
|
var x = (args)=>{ |
|
|
return ()=>{ |
|
|
return ()=>{ |
|
|
|
|
|
|
|
|
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)).then((srepo)=>{ |
|
|
|
|
|
repolog.statuslog(null, srepo)}).catch((e)=>{ console.error(e) }) |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
console.log('cloning ' + repo) |
|
|
|
|
|
// PB : TODO -- detect if a clonable repo exists in currentGitAuthUser |
|
|
// PB : TODO -- detect if a clonable repo exists in currentGitAuthUser |
|
|
return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', defaultRepoServer + `/${defaultRepoOwner}/` + repo + '.git'], |
|
|
return nodeShellExec('git', ['clone', '-c', 'core.symlinks=true', defaultRepoServer + `/${defaultRepoOwner}/` + repo + '.git'], |
|
|
{ |
|
|
{ |
|
|
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], |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if(!processedArgs.runas) gitRepos.forEach(performPull) |
|
|
|
|
|
|
|
|
if(!processedArgs.runas) { |
|
|
|
|
|
var pendingpulls = []; |
|
|
|
|
|
gitRepos.forEach( (r)=>{ |
|
|
|
|
|
pendingpulls.push(performPull(r)) |
|
|
|
|
|
} ) |
|
|
|
|
|
Promise.all(pendingpulls).then(results =>{ |
|
|
|
|
|
console.log(repolog.log.SUCCESS) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
return isRunningElevated().then( |
|
|
return isRunningElevated().then( |
|
|
(isElevated) => { |
|
|
(isElevated) => { |
|
|
if(isElevated) { |
|
|
if(isElevated) { |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
, 'npmi' : ()=>{ |
|
|
, 'npmi' : ()=>{ |
|
|
var tasks = []; |
|
|
var tasks = []; |
|
|
|
|
|
var bowerRepos = ['client'] |
|
|
|
|
|
|
|
|
|
|
|
var npmbuildrepos = ['loopback-jsonapi-model-serializer'] |
|
|
|
|
|
npmbuildrepos.forEach(repo => { |
|
|
|
|
|
tasks.push(()=>{ |
|
|
|
|
|
var p = nodeShellExec('npm', ['run build'], { |
|
|
|
|
|
inherit : true, shell: true |
|
|
|
|
|
, cwd : repo |
|
|
|
|
|
, env: process.env |
|
|
|
|
|
, title : `bower i for ${repo}` |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
bowerRepos.forEach(repo => { |
|
|
|
|
|
tasks.push(()=>{ |
|
|
|
|
|
var p = nodeShellExec('bower', ['install'], { |
|
|
|
|
|
inherit : true, shell: true |
|
|
|
|
|
, cwd : repo |
|
|
|
|
|
, env: process.env |
|
|
|
|
|
, title : `bower i for ${repo}` |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
gitRepos = gitRepos.concat(elevatedRunasRepos); |
|
|
|
|
|
gitRepos.push('client/server'); |
|
|
gitRepos.forEach(repo => { |
|
|
gitRepos.forEach(repo => { |
|
|
|
|
|
|
|
|
console.log('npm i for ' + repo) |
|
|
console.log('npm i for ' + repo) |
|
|
|
|
|
|
|
|
, env: process.env |
|
|
, env: process.env |
|
|
, title : `rm 'package-lock.json' for ${repo}` |
|
|
, title : `rm 'package-lock.json' for ${repo}` |
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
tasks.push(()=>{ |
|
|
|
|
|
var p = nodeShellExec('npm', ['i'], { |
|
|
|
|
|
inherit : true, shell: true |
|
|
|
|
|
, cwd : repo |
|
|
|
|
|
, env: process.env |
|
|
|
|
|
, title : `npm i for ${repo}` |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if( npmbuildrepos.indexOf(repo) != -1) { |
|
|
|
|
|
tasks.push(()=>{ |
|
|
|
|
|
var p = nodeShellExec('npm', ['i --force'], { |
|
|
|
|
|
inherit : true, shell: true |
|
|
|
|
|
, cwd : repo |
|
|
|
|
|
, env: process.env |
|
|
|
|
|
, title : `npm i for ${repo}` |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
}) |
|
|
}) |
|
|
any(tasks); |
|
|
any(tasks); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(0){ |
|
|
if(0){ |
|
|
// PB : TODO -- Special google chrome profile for tests etc. |
|
|
// PB : TODO -- Special google chrome profile for tests etc. |
|
|
nodeShellExec('pwd', { inherit : true}); |
|
|
nodeShellExec('pwd', { inherit : true}); |
|
|
//$ "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --profile-directory="Profile 1" http://localhost:4200/tests/index.html?grep=loopback |
|
|
|
|
|
|
|
|
// /c/Program\ Files\ \(x86\)/Google/Chrome/Application/chrome.exe --user-data-dir=/c/chess/instances/elixir_01/data/Google/Chrome/User\ Data --profile-directory="chess" |
|
|
|
|
|
// "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\chess\instances\elixir_01\data\Google\Chrome\User Data" --profile-directory="chess" http://localhost:4200/admin/crud/create/item |
|
|
|
|
|
// "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe" --user-data-dir="C:\chess\instances\elixir_01\data\Google\Chrome\User Data" --profile-directory="chess" http://localhost:4200/tests/index.html?grep=loopback |
|
|
nodeShellExec("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", [ |
|
|
nodeShellExec("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", [ |
|
|
"--profile-directory=Profile 1" |
|
|
"--profile-directory=Profile 1" |
|
|
, 'http://localhost:4200/tests/index.html?grep=model convert ember to loopback' + '&filter=none' /*+ '&filter=model convert ember to loopback'*/]); |
|
|
, 'http://localhost:4200/tests/index.html?grep=model convert ember to loopback' + '&filter=none' /*+ '&filter=model convert ember to loopback'*/]); |
|
|
|
|
|
|
|
|
// nodeShellExec('npm', ['init', '-y'], options); |
|
|
// nodeShellExec('npm', ['init', '-y'], options); |
|
|
// }) |
|
|
// }) |
|
|
|
|
|
|
|
|
var g = { |
|
|
|
|
|
'client' : ()=>{ |
|
|
|
|
|
console.info('Creating new ember client named : ' + processedArgs._[2] ) ; |
|
|
|
|
|
var step1 = nodeShellExec('cmd', ['/c', 'ember', 'new', processedArgs._[2]], { |
|
|
|
|
|
stdio: ['pipe', process.stdout, process.stderr], |
|
|
|
|
|
inherit : true, |
|
|
|
|
|
shell: true, |
|
|
|
|
|
cwd : path.dirname(__dirname), |
|
|
|
|
|
env: env |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
var g = { |
|
|
|
|
|
'client' : ()=>{ |
|
|
|
|
|
console.info('Creating new ember client named : ' + processedArgs._[2] ) ; |
|
|
|
|
|
var step1 = nodeShellExec('cmd', ['/c', 'ember', 'new', processedArgs._[2]], { |
|
|
|
|
|
stdio: ['pipe', process.stdout, process.stderr], |
|
|
|
|
|
inherit : true, |
|
|
|
|
|
shell: true, |
|
|
|
|
|
cwd : path.dirname(__dirname), |
|
|
|
|
|
env: env |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
'modelr' : ()=>{ |
|
|
|
|
|
var tasks = [ |
|
|
|
|
|
()=>{ |
|
|
|
|
|
var p = nodeShellExec('"ember"', [ |
|
|
|
|
|
'g' |
|
|
|
|
|
, 'modelr' |
|
|
|
|
|
, processedArgs._[2]], { |
|
|
|
|
|
inherit : true, shell: true, env: process.env |
|
|
|
|
|
}).then(()=>{ |
|
|
|
|
|
console.log('Blueprint generation complete for : ' + processedArgs._[2]) |
|
|
|
|
|
return true; |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
}, |
|
|
|
|
|
()=>{ |
|
|
|
|
|
var chromePrefsFile = "C:\\chess\\instances\\elixir_01\\data\\Google\\Chrome\\User Data\\chess\\Preferences"; |
|
|
|
|
|
var chromeprefs = fs.readFileSync(chromePrefsFile, { encoding: 'utf8' }) |
|
|
|
|
|
chromeprefs = JSON.parse(chromeprefs) |
|
|
|
|
|
var previous = chromeprefs.download.default_directory; |
|
|
|
|
|
var parentDir = path.dirname(__dirname); |
|
|
|
|
|
chromeprefs.download.default_directory = parentDir + "\\client\\app\\templates\\components\\resource"; |
|
|
|
|
|
fs.writeFileSync(chromePrefsFile, JSON.stringify(chromeprefs)) |
|
|
|
|
|
// PB : TODO -- detect where chrome is installed. |
|
|
|
|
|
// PB : TODO -- set the download dir to the place where files are needed. |
|
|
|
|
|
var p = nodeShellExec('"C:/Program Files (x86)/Google/Chrome/Application/chrome.exe"', [ |
|
|
|
|
|
'--user-data-dir="C:\\chess\\instances\\elixir_01\\data\\Google\\Chrome\\User Data"' |
|
|
|
|
|
, '--profile-directory="chess"' |
|
|
|
|
|
, 'http://localhost:4200/admin/crud/create/' + processedArgs._[2]], { |
|
|
|
|
|
inherit : true, shell: true |
|
|
|
|
|
, env: process.env |
|
|
|
|
|
}).then(()=>{ |
|
|
|
|
|
chromeprefs.download.default_directory = previous; |
|
|
|
|
|
fs.writeFileSync(chromePrefsFile, JSON.stringify(chromeprefs)) |
|
|
|
|
|
return true; |
|
|
|
|
|
}).catch((e)=>{ console.error(e) }) |
|
|
|
|
|
return p; |
|
|
|
|
|
} |
|
|
|
|
|
, |
|
|
|
|
|
()=>{ |
|
|
|
|
|
console.log('Browser process should have closed here....') |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
] |
|
|
|
|
|
any(tasks) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
g[processedArgs._[1]](); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
g[processedArgs._[1]](); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
return op[label] ? op[label]() : null; |
|
|
return op[label] ? op[label]() : null; |
|
|
|
|
|
|
|
|
p.process = child; |
|
|
p.process = child; |
|
|
return p; |
|
|
return p; |
|
|
} |
|
|
} |
|
|
|
|
|
|