cob-cli 2.46.0-beta.6 → 2.46.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,11 +10,11 @@ async function getDefs(args) {
10
10
  const cmdEnv = await getCurrentCommandEnviroment(args)
11
11
 
12
12
  console.log(`Getting definitions from ${cmdEnv.serverStr} to branch ${cmdEnv.branchStr} ...` );
13
- const getDefs = spawn(path.resolve(__dirname,"..","task_lists","getDefs.sh"),[cmdEnv.server, cmdEnv.name, path.resolve(__dirname) ])
13
+ const getDefs = spawn(path.resolve(__dirname,"..","task_lists","getDefs.sh"),[cmdEnv.serverHTTPs, cmdEnv.name, path.resolve(__dirname) ])
14
14
  getDefs.stdout.on('data', function (data) { console.log(" " + data.toString()); });
15
15
  getDefs.on('exit', function () { console.log('Done!'); });
16
16
  } catch(err) {
17
17
  console.error("\n",err.message);
18
18
  }
19
19
  }
20
- module.exports = getDefs;
20
+ module.exports = getDefs;
@@ -16,7 +16,7 @@ async function init(servername,args) {
16
16
  let initTasks;
17
17
  if(await projectExistsInGitAccount(projectName,args.repoaccount) ) {
18
18
  console.log("\nRepo cloned!".green);
19
- } else if( projectPathOkFor(projectName) && await notInsideGitRepo() && await validCobServer(cmdEnv.server)) {
19
+ } else if( projectPathOkFor(projectName) && await notInsideGitRepo() && await validCobServer(cmdEnv.serverHTTPs)) {
20
20
  console.log("\nCreating project", projectName.bold.blue );
21
21
  initTasks = newProjectTasks(cmdEnv, projectName, repo, args )
22
22
  initTasks.run()
@@ -76,4 +76,4 @@ async function projectExistsInGitAccount(projectName, repoaccount) {
76
76
  } catch (e) {
77
77
  return false
78
78
  }
79
- }
79
+ }
@@ -24,7 +24,7 @@ async function test (args) {
24
24
  await cmdEnv.applyCurrentCommandEnvironmentChanges()
25
25
  }
26
26
  spawned = await customUIsContinuosReload(cmdEnv, args.dashboard)
27
-
27
+
28
28
  let key;
29
29
  do {
30
30
  key = await getKeypress()
@@ -37,11 +37,8 @@ async function test (args) {
37
37
  } finally {
38
38
  restoreChanges && await restoreChanges()
39
39
  cmdEnv && await cmdEnv.unApplyCurrentCommandEnvironmentChanges() // Repõe as configurações
40
- if(spawned) spawned.forEach( spawn => {
41
- spawn.kill("SIGINT");
42
- })
43
- process.kill(process.pid, "SIGINT");
44
- // Dá tempo aos subprocessos para morrer
40
+ await spawned.stop();
41
+ // Dá tempo aos subprocessos para morrer (acho que já não é preciso)
45
42
  setTimeout(() => {
46
43
  if(!error) {
47
44
  console.log( "\n"
@@ -15,7 +15,8 @@ async function getCurrentCommandEnviroment(args, newServername) {
15
15
 
16
16
  const defaultEnvironmentServerName = newServername ? newServername : _getDefaultServerForEnvironment(environmentName);
17
17
  const servername = args.servername ? args.servername : defaultEnvironmentServerName;
18
- const server = _getServerFQDN(servername)
18
+ const server = _getServerSSHFQDN(servername)
19
+ const serverHTTPs = _getServerHTTPsFQDN(servername)
19
20
  const currentBranch = newServername ? "master" : await getCurrentBranch();
20
21
 
21
22
  const lastEnvironmentDeployedToServer = await _getLastEnvironmentDeployed(server)
@@ -47,6 +48,7 @@ async function getCurrentCommandEnviroment(args, newServername) {
47
48
  name: environmentName,
48
49
  servername: servername,
49
50
  server: server,
51
+ serverHTTPs: serverHTTPs,
50
52
  serverStr: serverStr,
51
53
  currentBranch: currentBranch,
52
54
  branchStr: branchStr,
@@ -117,10 +119,15 @@ function _getDefaultServerForEnvironment(environmentName) {
117
119
  }
118
120
 
119
121
  /* ************************************ */
120
- function _getServerFQDN(servername) {
122
+ function _getServerSSHFQDN(servername) {
121
123
  return servername + ".cultofbits.pt";
122
124
  }
123
125
 
126
+ /* ************************************ */
127
+ function _getServerHTTPsFQDN(servername) {
128
+ return servername + ".cultofbits.com";
129
+ }
130
+
124
131
  /* ************************************ */
125
132
  async function _getLastEnvironmentDeployed(server) {
126
133
  try {
@@ -140,4 +147,4 @@ async function _setLastEnvironmentDeployed(server, environmentName) {
140
147
  async function _setupEnvironment(environmentName, servername, server) {
141
148
  await fs.mkdirs("environments/" + environmentName);
142
149
  await fs.writeFile("environments/" + environmentName + "/server", servername);
143
- }
150
+ }
@@ -2,12 +2,17 @@ const execa = require('execa');
2
2
  const path = require('path');
3
3
  const concurrently = require('concurrently');
4
4
  const fs= require('fs');
5
+ const util = require('util');
6
+ const child_process = require('child_process');
7
+ const exec = util.promisify(child_process.exec);
8
+
5
9
 
6
10
  async function customUIsContinuosReload(cmdEnv, dashboard) {
7
11
  process.env.dash_dir = dashboard
8
- process.env.server = "https://" + cmdEnv.server
12
+ process.env.server = "https://" + cmdEnv.serverHTTPs
9
13
 
10
14
  let commands = []
15
+ let isStopping = false;
11
16
 
12
17
  let dashboardPath = path.resolve(".") + "/recordm/customUI/" + dashboard;
13
18
  let dashboardPathIsDirectory = false;
@@ -54,11 +59,33 @@ async function customUIsContinuosReload(cmdEnv, dashboard) {
54
59
  killOthers: ['failure', 'success']
55
60
  });
56
61
 
62
+ const stopEverything = async function(){
63
+ isStopping = true;
64
+ for(const spawn of conc.commands) {
65
+ // console.log("\n killing spawn [" + spawn.pid + "] " + spawn.command )
66
+
67
+ // win32 seems to not kill child processes, and concurrently wraps executions with a cmd.exe shell
68
+ if (process.platform === 'win32') {
69
+ try {
70
+ await exec(`taskkill /PID ${spawn.pid} /T /F`)
71
+ } catch (err) {
72
+ console.error("error trying to taskkill process tree", err)
73
+ }
74
+
75
+ } else {
76
+ spawn.kill("SIGINT");
77
+ }
78
+ }
79
+ }
80
+
57
81
  conc.result.catch( _err => {
58
- console.log("press any key " + "(except enter)".red + " to stop the tests... \n ")
59
- process.kill(process.pid, "SIGINT");
82
+ if(isStopping) return;
83
+
84
+ stopEverything();
60
85
  });
61
86
 
62
- return conc.commands;
87
+ return {
88
+ stop: stopEverything
89
+ };
63
90
  }
64
91
  exports.customUIsContinuosReload = customUIsContinuosReload;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cob-cli",
3
- "version": "2.46.0-beta.6",
3
+ "version": "2.46.0-beta.8",
4
4
  "description": "A command line utility to help Cult of Bits partners develop with higher speed and reusing common code and best practices.",
5
5
  "preferGlobal": true,
6
6
  "repository": {