cob-cli 2.44.0 → 2.46.0-beta.1
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.
- package/.tool-versions +1 -0
- package/bin/cob-cli.js +4 -4
- package/bin/handleAutoComplete.js +5 -1
- package/lib/task_lists/common_enviromentHandler.js +1 -1
- package/lib/task_lists/common_helpers.js +8 -1
- package/lib/task_lists/common_syncFiles.js +25 -19
- package/lib/task_lists/test_otherFilesContiousReload.js +3 -1
- package/package.json +1 -1
- package/tsconfig.json +10 -0
package/.tool-versions
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
nodejs 16.20.2
|
package/bin/cob-cli.js
CHANGED
|
@@ -40,7 +40,7 @@ program
|
|
|
40
40
|
.option('-l --legacy <folder>','import git history from legacy ClientConfs. <folder> should be path to server files inside ClienConfs.')
|
|
41
41
|
.option('-a --repoaccount <account url>', 'Specify git account to use', "git@gitlab.com:cob/")
|
|
42
42
|
.option('-V --verbose', 'verbose execution of tasks', increaseVerbosity, 0)
|
|
43
|
-
.description('Initializes a server customization repository. Use <servername>.cultofbits.
|
|
43
|
+
.description('Initializes a server customization repository. Use <servername>.cultofbits.pt (i.e. name without the FQDN)')
|
|
44
44
|
.action( init );
|
|
45
45
|
|
|
46
46
|
program
|
|
@@ -60,7 +60,7 @@ program
|
|
|
60
60
|
.option('-e --environment <name>', 'environment to use')
|
|
61
61
|
.option('-d --dashboard <name>', 'Aditionally specify a VUE dashboard to test')
|
|
62
62
|
.option('-l --localOnly', 'test only localFiles (customUI)')
|
|
63
|
-
.option('-s --servername <servername>', 'use <servername>.cultofbits.
|
|
63
|
+
.option('-s --servername <servername>', 'use <servername>.cultofbits.pt (i.e. name without the FQDN)')
|
|
64
64
|
.description('Test the customization')
|
|
65
65
|
.action( test );
|
|
66
66
|
|
|
@@ -69,7 +69,7 @@ program
|
|
|
69
69
|
.option('-f --force', 'skips comparisons')
|
|
70
70
|
.option('-e --environment <name>', 'environment to use')
|
|
71
71
|
.option('-V --verbose', 'verbose execution of tasks', increaseVerbosity, 0)
|
|
72
|
-
.option('-s --servername <servername>', 'use <servername>.cultofbits.
|
|
72
|
+
.option('-s --servername <servername>', 'use <servername>.cultofbits.pt (i.e. name without the FQDN)')
|
|
73
73
|
.description('Deploy customization to the server')
|
|
74
74
|
.action( deploy );
|
|
75
75
|
|
|
@@ -77,7 +77,7 @@ program
|
|
|
77
77
|
.command('updateFromServer')
|
|
78
78
|
.description('Updates local copy with current files on server, in case of changes made out of standard process.')
|
|
79
79
|
.option('-e --environment <name>', 'environment to use')
|
|
80
|
-
.option('-s --servername <servername>', 'use <servername>.cultofbits.
|
|
80
|
+
.option('-s --servername <servername>', 'use <servername>.cultofbits.pt (i.e. name without the FQDN)')
|
|
81
81
|
.option('-V --verbose', 'verbose execution of tasks', increaseVerbosity, 0)
|
|
82
82
|
.action( updateFromServer );
|
|
83
83
|
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
const path = require('path');
|
|
2
2
|
|
|
3
|
+
if(process.platform === 'win32'){
|
|
4
|
+
return;
|
|
5
|
+
}
|
|
6
|
+
|
|
3
7
|
/* Autocomplete Component*/
|
|
4
8
|
var omelette = require('omelette');
|
|
5
9
|
const commandStructure = {
|
|
@@ -22,4 +26,4 @@ if (~process.argv.indexOf('--setup')) {
|
|
|
22
26
|
if (~process.argv.indexOf('--cleanup')) {
|
|
23
27
|
console.log("Cleaning...")
|
|
24
28
|
completion.cleanupShellInitFile()
|
|
25
|
-
}
|
|
29
|
+
}
|
|
@@ -118,7 +118,7 @@ function _getDefaultServerForEnvironment(environmentName) {
|
|
|
118
118
|
|
|
119
119
|
/* ************************************ */
|
|
120
120
|
function _getServerFQDN(servername) {
|
|
121
|
-
return servername + ".cultofbits.
|
|
121
|
+
return servername + ".cultofbits.pt";
|
|
122
122
|
}
|
|
123
123
|
|
|
124
124
|
/* ************************************ */
|
|
@@ -31,7 +31,14 @@ async function checkWorkingCopyCleanliness(testNotDetached=true) {
|
|
|
31
31
|
/* ************************************ */
|
|
32
32
|
function checkConnectivity(server) {
|
|
33
33
|
const execa = require('execa');
|
|
34
|
-
return execa('ssh', [
|
|
34
|
+
return execa('ssh', [
|
|
35
|
+
"-o", "StrictHostKeyChecking=no",
|
|
36
|
+
"-o", "PreferredAuthentications=publickey",
|
|
37
|
+
"-o", "BatchMode=yes",
|
|
38
|
+
"-o", "ConnectTimeout=15",
|
|
39
|
+
server,
|
|
40
|
+
"test -w /etc/recordm/services/com.cultofbits.web.integration.properties && exit || exit 1"
|
|
41
|
+
])
|
|
35
42
|
}
|
|
36
43
|
|
|
37
44
|
/* ************************************ */
|
|
@@ -5,7 +5,7 @@ const { getKeypress } = require("../task_lists/common_helpers");
|
|
|
5
5
|
|
|
6
6
|
/* ************************************ */
|
|
7
7
|
const COB_PRODUCTS = ["recordm", "integrationm", "recordm-importer", "reportm", "userm", "confm", "others"];
|
|
8
|
-
|
|
8
|
+
|
|
9
9
|
_syncFiles.TEST = "Test equality";
|
|
10
10
|
_syncFiles.DIFF = "Get differences";
|
|
11
11
|
_syncFiles.COPY = "Copy";
|
|
@@ -45,29 +45,35 @@ async function _syncFiles(executionType, cmdEnv, from, to, extraOptions = [], ar
|
|
|
45
45
|
while (count < RSYNC_RETRIES) {
|
|
46
46
|
if (args.verbose > 2)
|
|
47
47
|
console.log("rsync".bold +" '" + (product).blue + "': attempt " + (count + 1));
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
48
|
+
const rsyncArgs = [
|
|
49
|
+
fromPath,
|
|
50
|
+
toPath,
|
|
51
|
+
"-acvi",
|
|
52
|
+
"--delete",
|
|
53
|
+
"--chmod=g+w",
|
|
54
|
+
"--no-perms",
|
|
55
|
+
"--no-t",
|
|
56
|
+
"--filter='merge " + path.resolve(__dirname,"rsyncFilter-pre.txt") + "'",
|
|
57
|
+
hasRsyncFilter ? "--filter='merge " + cmdEnv.rsyncFilter + "'" : "",
|
|
58
|
+
"--filter='merge " + path.resolve(__dirname,"rsyncFilter-post.txt") + "'",
|
|
59
|
+
executionType == _syncFiles.COPY ? "-v" : "--dry-run"
|
|
60
|
+
].concat(productExtraOptions)
|
|
61
|
+
if (args.verbose > 3) {
|
|
62
|
+
console.log('rsync', rsyncArgs.join(' '))
|
|
63
|
+
}
|
|
64
|
+
await execa('rsync', rsyncArgs, {
|
|
65
|
+
shell: true,
|
|
66
|
+
env: { "RSYNC_RSH": "ssh -o ConnectTimeout=30 -o ServerAliveInterval=30 -o ServerAliveCountMax=30" }
|
|
67
|
+
})
|
|
64
68
|
.then((value) => {
|
|
65
|
-
if (args.verbose >
|
|
69
|
+
if (args.verbose > 3)
|
|
66
70
|
console.log("rsync".bold +" '" + (product).blue + "': " + "success".green + " " + value.stdout);
|
|
67
71
|
|
|
68
72
|
let result = _formatRsyncOutput(product, value.stdout);
|
|
69
73
|
if (args.verbose > 2)
|
|
70
74
|
console.log("rsync '" + product + "': success " + result);
|
|
75
|
+
else if (args.verbose > 1)
|
|
76
|
+
console.log("rsync '" + product + "': success ");
|
|
71
77
|
changes = changes.concat(result);
|
|
72
78
|
count = RSYNC_RETRIES;
|
|
73
79
|
|
|
@@ -92,7 +98,7 @@ async function _syncFiles(executionType, cmdEnv, from, to, extraOptions = [], ar
|
|
|
92
98
|
.filter(line => !/write error: Broken pipe/.test(line) && !fs.existsSync(to)) // quando não existe localmente dir base
|
|
93
99
|
;
|
|
94
100
|
if(relevantErrors.length == 0){
|
|
95
|
-
if (args.verbose >
|
|
101
|
+
if (args.verbose > 1)
|
|
96
102
|
console.log("rsync '" + product + "': success ");
|
|
97
103
|
count = RSYNC_RETRIES;
|
|
98
104
|
resolve();
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const chokidar = require('chokidar');
|
|
2
|
+
const path = require('path');
|
|
2
3
|
const fs = require('fs-extra');
|
|
3
4
|
const execa = require('execa');
|
|
4
5
|
const git = require('simple-git');
|
|
@@ -63,7 +64,8 @@ async function otherFilesContiousReload(cmdEnv) {
|
|
|
63
64
|
usePolling: true,
|
|
64
65
|
ignoreInitial: true
|
|
65
66
|
});
|
|
66
|
-
watcher.process.on('all', async (eventType,
|
|
67
|
+
watcher.process.on('all', async (eventType, changedFileNative) => {
|
|
68
|
+
let changedFile = changedFileNative.split(path.sep).join(path.posix.sep)
|
|
67
69
|
// Não é preciso fazer nada para directorias que só existem no servidor
|
|
68
70
|
let product = changedFile.split("/")[0];
|
|
69
71
|
let productDir = resolveCobPath(cmdEnv.server, "serverLive", product).split(":")[1];
|
package/package.json
CHANGED