123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134 |
-
-
-
-
- const { spawn } = require('child_process');
- const cliargs = require('../elxr/cliargs');
- const processedArgs = cliargs(process.argv.slice(2));
- console.dir(processedArgs)
-
- var cli = 'elxr';
- var ver = '#unversioned';
- var help = '#unkown list of commands... please refer dveloper documentation for ' + cli;
-
-
-
-
-
-
- var dbForLabel = function(label){
- var dbsForLabel = {
- devmysql : 'mysql'
- , development : 'mssql'
- , production : 'mssql'
- }
- return dbsForLabel[label] || 'mysql'
- }
-
- var __runcmd = function(label){
-
- var op = {
- 'h' : ()=>{ console.log(cli + ' ' + ver + ' ' + help); return '-h' }
- , 'start' : (label)=>{
- console.log('Starting Elixir Server.');
- var env = Object.assign({}, process.env);
-
- env.NODE_ENV = label;
- env.DEBUG = 'loopback:connector:' + dbForLabel(label)
-
- nodeShellExec('node', ['--inspect=9228', 'sage-rw/server.js'], {
- inherit : true,
- shell: true, detached: true,
- cwd : 'loopback',
- env: env,
- shell : true
- })
-
- nodeShellExec('node', ['--inspect=9227', 'sage-r/server.js'], {
- inherit : true,
- shell: true, detached: true,
- cwd : 'loopback',
- env: env,
- shell : true
- })
-
-
-
-
-
-
-
-
-
- nodeShellExec('ember', ['s'], {
- inherit : true,
- shell: true, detached: true,
- cwd : 'qms/',
- env: env,
- shell : true
- })
- }
- , 'g' : ()=>{
- if(processedArgs.h) {
-
- console.log('elxr g [modelname] => generate a model named [modelname]');
- console.log('elxr g => regenerate all known models');
- return
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- nodeShellExec('pwd', { inherit : true});
-
- nodeShellExec("C:/Program Files (x86)/Google/Chrome/Application/chrome.exe", [
- "--profile-directory=Profile 1"
- , 'http://localhost:4200/tests/index.html?grep=model convert ember to loopback' + '&filter=none' ]);
-
-
-
-
- }
- }
- return op[label] ? op[label]() : op['start'](label);
- }
-
-
-
-
- var mysql = '../xampp/mysql/bin/mysql'
- var mysqldump = '../xampp/mysql/bin/mysqldump'
-
- __runcmd(processedArgs.label || processedArgs._[0] || 'h');
-
-
- function nodeShellExec() {
-
- const child = spawn(...arguments);
-
-
- child.stdout.setEncoding('utf8');
-
-
- child.stdout.on('data', (chunk) => console.log(chunk));
-
- child.on('error', (chunk) => console.error(chunk));
- child.stderr.pipe(process.stderr);
-
- child.on('close', (code) => console.log(`child process ${Array.from(arguments)[0]} exited with code ${code}`));
- return child;
- }
|