legispro-cli 1.0.7 → 1.0.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.
- package/LICENSE +21 -21
- package/README.md +45 -17
- package/bin/dev.cmd +3 -3
- package/bin/dev.js +5 -0
- package/bin/run.cmd +3 -3
- package/bin/run.js +5 -0
- package/dist/commands/backup/create.js +13 -16
- package/dist/commands/backup/list.js +15 -18
- package/dist/commands/collection/add.d.ts +3 -3
- package/dist/commands/collection/add.js +31 -34
- package/dist/commands/collection/create.d.ts +5 -5
- package/dist/commands/collection/create.js +46 -49
- package/dist/commands/collection/delete.d.ts +1 -1
- package/dist/commands/collection/delete.js +20 -23
- package/dist/commands/collection/download.d.ts +2 -2
- package/dist/commands/collection/download.js +28 -31
- package/dist/commands/collection/get.d.ts +1 -1
- package/dist/commands/collection/get.js +21 -24
- package/dist/commands/collection/list.js +13 -16
- package/dist/commands/collection/perms.d.ts +3 -3
- package/dist/commands/collection/perms.js +29 -32
- package/dist/commands/collection/update.d.ts +7 -7
- package/dist/commands/collection/update.js +50 -54
- package/dist/commands/collection/upload.d.ts +3 -3
- package/dist/commands/collection/upload.js +39 -42
- package/dist/commands/config/get.d.ts +5 -1
- package/dist/commands/config/get.js +7 -10
- package/dist/commands/config/set.d.ts +5 -1
- package/dist/commands/config/set.js +41 -24
- package/dist/commands/db/init.js +18 -21
- package/dist/commands/db/memory.js +10 -12
- package/dist/commands/db/uptime.js +8 -10
- package/dist/commands/db/version.js +8 -10
- package/dist/commands/deploy/index.d.ts +10 -0
- package/dist/commands/deploy/index.js +126 -0
- package/dist/commands/document/copy.js +15 -18
- package/dist/commands/document/list.js +15 -18
- package/dist/commands/group/create.d.ts +5 -5
- package/dist/commands/group/create.js +36 -39
- package/dist/commands/group/delete.d.ts +1 -1
- package/dist/commands/group/delete.js +19 -22
- package/dist/commands/group/get.d.ts +1 -1
- package/dist/commands/group/get.js +20 -23
- package/dist/commands/group/list.js +8 -10
- package/dist/commands/group/update.d.ts +5 -5
- package/dist/commands/group/update.js +36 -39
- package/dist/commands/locks/add.js +16 -18
- package/dist/commands/locks/clear.js +11 -13
- package/dist/commands/services/health.js +11 -14
- package/dist/commands/user/create.d.ts +17 -17
- package/dist/commands/user/create.js +104 -107
- package/dist/commands/user/delete.d.ts +1 -1
- package/dist/commands/user/delete.js +24 -27
- package/dist/commands/user/get.d.ts +1 -1
- package/dist/commands/user/get.js +20 -23
- package/dist/commands/user/list.js +10 -13
- package/dist/commands/user/login.d.ts +2 -2
- package/dist/commands/user/login.js +30 -33
- package/dist/commands/user/update.d.ts +16 -16
- package/dist/commands/user/update.js +108 -111
- package/dist/index.js +1 -5
- package/dist/lib/fusiondb-client.d.ts +2 -1
- package/dist/lib/fusiondb-client.js +19 -18
- package/dist/lib/gh.d.ts +26 -0
- package/dist/lib/gh.js +37 -0
- package/dist/lib/rclone-client.js +12 -15
- package/dist/lib/shell.d.ts +24 -0
- package/dist/lib/shell.js +68 -0
- package/dist/lib/types.js +1 -2
- package/dist/lib/utils.d.ts +2 -2
- package/dist/lib/utils.js +4 -7
- package/dist/lib/xml-templates.js +61 -65
- package/oclif.manifest.json +958 -520
- package/package.json +102 -98
- package/bin/dev +0 -17
- package/bin/run +0 -5
- package/dist/commands/locks/list.d.ts +0 -7
- package/dist/commands/locks/list.js +0 -86
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
7
|
-
class ConfigGet extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import fs from 'fs-extra';
|
|
4
|
+
class ConfigGet extends Command {
|
|
8
5
|
async run() {
|
|
9
|
-
const configPath =
|
|
10
|
-
const data =
|
|
6
|
+
const configPath = path.join(this.config.configDir, 'config.json');
|
|
7
|
+
const data = fs.readFileSync(configPath);
|
|
11
8
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
12
9
|
// @ts-ignore
|
|
13
10
|
const config = JSON.parse(data);
|
|
@@ -16,4 +13,4 @@ class ConfigGet extends core_1.Command {
|
|
|
16
13
|
}
|
|
17
14
|
}
|
|
18
15
|
ConfigGet.description = 'Get your current configuration.';
|
|
19
|
-
|
|
16
|
+
export default ConfigGet;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const fs_extra_1 = tslib_1.__importDefault(require("fs-extra"));
|
|
8
|
-
class ConfigSet extends core_1.Command {
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import enquirer from 'enquirer';
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import fs from 'fs-extra';
|
|
5
|
+
class ConfigSet extends Command {
|
|
9
6
|
async run() {
|
|
10
7
|
const { flags } = await this.parse(ConfigSet);
|
|
11
|
-
const config =
|
|
8
|
+
const config = path.join(this.config.configDir, 'config.json');
|
|
12
9
|
if (!flags.hostname ||
|
|
13
10
|
!flags.protocol ||
|
|
14
11
|
!flags.port ||
|
|
@@ -16,7 +13,7 @@ class ConfigSet extends core_1.Command {
|
|
|
16
13
|
!flags.password ||
|
|
17
14
|
!flags.webdav ||
|
|
18
15
|
!flags.group) {
|
|
19
|
-
const res = await
|
|
16
|
+
const res = await enquirer.prompt([
|
|
20
17
|
{
|
|
21
18
|
type: 'input',
|
|
22
19
|
name: 'hostname',
|
|
@@ -63,6 +60,26 @@ class ConfigSet extends core_1.Command {
|
|
|
63
60
|
message: 'What the default user group?',
|
|
64
61
|
required: true,
|
|
65
62
|
},
|
|
63
|
+
{
|
|
64
|
+
type: 'input',
|
|
65
|
+
name: 'deploymentSSHAccount',
|
|
66
|
+
message: 'Deployment SSH account'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
type: 'password',
|
|
70
|
+
name: 'deploymentSSHPassword',
|
|
71
|
+
message: 'Deployment SSH password'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
type: 'input',
|
|
75
|
+
name: 'gitRepository',
|
|
76
|
+
message: 'Release Git repository'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
type: 'password',
|
|
80
|
+
name: 'gitToken',
|
|
81
|
+
message: 'Release Git token'
|
|
82
|
+
},
|
|
66
83
|
]);
|
|
67
84
|
for (const key in res) {
|
|
68
85
|
// eslint-disable-next-line no-prototype-builtins
|
|
@@ -73,8 +90,8 @@ class ConfigSet extends core_1.Command {
|
|
|
73
90
|
}
|
|
74
91
|
}
|
|
75
92
|
}
|
|
76
|
-
await
|
|
77
|
-
await
|
|
93
|
+
await fs.ensureDir(this.config.configDir);
|
|
94
|
+
await fs.writeJson(config, {
|
|
78
95
|
hostname: flags.hostname,
|
|
79
96
|
protocol: flags.protocol,
|
|
80
97
|
port: flags.port,
|
|
@@ -82,44 +99,44 @@ class ConfigSet extends core_1.Command {
|
|
|
82
99
|
password: flags.password,
|
|
83
100
|
webdav: flags.webdav,
|
|
84
101
|
group: flags.group,
|
|
102
|
+
deploymentSSHAccount: flags.deploymentSSHAccount,
|
|
103
|
+
deploymentSSHPassword: flags.deploymentSSHPassword,
|
|
104
|
+
gitRepository: flags.gitRepository,
|
|
105
|
+
gitToken: flags.gitToken
|
|
85
106
|
});
|
|
86
|
-
// if (flags.json) {
|
|
87
|
-
// this.log(JSON.stringify(await credentials(this)));
|
|
88
|
-
// this.exit();
|
|
89
|
-
// }
|
|
90
107
|
this.log('Your LegisPro CLI configuration has been generated!');
|
|
91
108
|
this.exit();
|
|
92
109
|
}
|
|
93
110
|
}
|
|
94
111
|
ConfigSet.flags = {
|
|
95
|
-
hostname:
|
|
112
|
+
hostname: Flags.string({
|
|
96
113
|
description: 'Hostname',
|
|
97
114
|
required: false,
|
|
98
115
|
}),
|
|
99
|
-
protocol:
|
|
116
|
+
protocol: Flags.string({
|
|
100
117
|
description: 'Protocol',
|
|
101
118
|
required: false,
|
|
102
119
|
}),
|
|
103
|
-
port:
|
|
120
|
+
port: Flags.string({
|
|
104
121
|
description: 'Port',
|
|
105
122
|
required: false,
|
|
106
123
|
}),
|
|
107
|
-
user:
|
|
124
|
+
user: Flags.string({
|
|
108
125
|
description: 'Admin user',
|
|
109
126
|
required: false,
|
|
110
127
|
}),
|
|
111
|
-
password:
|
|
128
|
+
password: Flags.string({
|
|
112
129
|
description: 'Admin password',
|
|
113
130
|
required: false,
|
|
114
131
|
}),
|
|
115
|
-
webdav:
|
|
132
|
+
webdav: Flags.string({
|
|
116
133
|
description: 'WebDAV path',
|
|
117
134
|
required: false,
|
|
118
135
|
}),
|
|
119
|
-
group:
|
|
136
|
+
group: Flags.string({
|
|
120
137
|
description: 'User group',
|
|
121
138
|
required: false,
|
|
122
139
|
}),
|
|
123
140
|
};
|
|
124
141
|
ConfigSet.description = 'Sets your user configuration.';
|
|
125
|
-
|
|
142
|
+
export default ConfigSet;
|
package/dist/commands/db/init.js
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
7
|
-
const add_1 = tslib_1.__importDefault(require("../locks/add"));
|
|
8
|
-
class DbInit extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import LocksAdd from "../locks/add.js";
|
|
5
|
+
class DbInit extends Command {
|
|
9
6
|
async run() {
|
|
10
|
-
const configFile =
|
|
7
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
11
8
|
const env = require(configFile);
|
|
12
|
-
|
|
9
|
+
client.setConfig(this);
|
|
13
10
|
// [1] create repository collection
|
|
14
|
-
let collection_exists = await
|
|
11
|
+
let collection_exists = await client.existsCollection('/db/repository');
|
|
15
12
|
if (!collection_exists) {
|
|
16
13
|
this.log("Creating /db/repository collection...");
|
|
17
14
|
let collection = {
|
|
@@ -20,14 +17,14 @@ class DbInit extends core_1.Command {
|
|
|
20
17
|
group: 'dba',
|
|
21
18
|
mode: 'rwxr-xr-x',
|
|
22
19
|
};
|
|
23
|
-
let create_response = await
|
|
24
|
-
let modify_response = await
|
|
20
|
+
let create_response = await client.createCollection(collection);
|
|
21
|
+
let modify_response = await client.modifyCollection(collection);
|
|
25
22
|
}
|
|
26
23
|
else {
|
|
27
24
|
this.log("/db/repository already exists.");
|
|
28
25
|
}
|
|
29
26
|
// [2] create users group
|
|
30
|
-
let res = await
|
|
27
|
+
let res = await client.getGroup('users');
|
|
31
28
|
if (res.status != 200) {
|
|
32
29
|
this.log("Creating users group...");
|
|
33
30
|
let meta = [];
|
|
@@ -48,13 +45,13 @@ class DbInit extends core_1.Command {
|
|
|
48
45
|
managers: ["admin"],
|
|
49
46
|
metadata: meta,
|
|
50
47
|
};
|
|
51
|
-
let create_group_response = await
|
|
48
|
+
let create_group_response = await client.createGroup(users_group);
|
|
52
49
|
}
|
|
53
50
|
else {
|
|
54
51
|
this.log("Users group already exists.");
|
|
55
52
|
}
|
|
56
53
|
// [3] create primary group
|
|
57
|
-
let res_primary_group = await
|
|
54
|
+
let res_primary_group = await client.getGroup(env.group);
|
|
58
55
|
if (res_primary_group.status != 200) {
|
|
59
56
|
this.log("Creating primary group...");
|
|
60
57
|
let meta = [];
|
|
@@ -75,16 +72,16 @@ class DbInit extends core_1.Command {
|
|
|
75
72
|
managers: ["admin"],
|
|
76
73
|
metadata: meta,
|
|
77
74
|
};
|
|
78
|
-
let create_primary_user_group_response = await
|
|
75
|
+
let create_primary_user_group_response = await client.createGroup(primary_user_group);
|
|
79
76
|
}
|
|
80
77
|
else {
|
|
81
78
|
this.log("Primary user group already exists.");
|
|
82
79
|
}
|
|
83
80
|
// [4] add locks
|
|
84
|
-
await
|
|
81
|
+
await LocksAdd.run();
|
|
85
82
|
this.exit();
|
|
86
83
|
}
|
|
84
|
+
static description = "Initialize a new database";
|
|
85
|
+
static examples = [`$ legispro db:init`];
|
|
87
86
|
}
|
|
88
|
-
|
|
89
|
-
DbInit.examples = [`$ legispro db:init`];
|
|
90
|
-
exports.default = DbInit;
|
|
87
|
+
export default DbInit;
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("../../lib/utils");
|
|
5
|
-
class DbMemory extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
class DbMemory extends Command {
|
|
6
4
|
async run() {
|
|
7
|
-
|
|
8
|
-
let mem_total_response = await
|
|
9
|
-
let mem_max_response = await
|
|
10
|
-
let mem_free_response = await
|
|
5
|
+
client.setConfig(this);
|
|
6
|
+
let mem_total_response = await client.memoryTotal();
|
|
7
|
+
let mem_max_response = await client.memoryMax();
|
|
8
|
+
let mem_free_response = await client.memoryFree();
|
|
11
9
|
this.log(" Memory Status");
|
|
12
10
|
this.log("================");
|
|
13
11
|
if (mem_total_response.status == 200) {
|
|
@@ -21,7 +19,7 @@ class DbMemory extends core_1.Command {
|
|
|
21
19
|
}
|
|
22
20
|
this.exit();
|
|
23
21
|
}
|
|
22
|
+
static description = "Database memory status";
|
|
23
|
+
static examples = [`$ legispro db:memory`,];
|
|
24
24
|
}
|
|
25
|
-
|
|
26
|
-
DbMemory.examples = [`$ legispro db:memory`,];
|
|
27
|
-
exports.default = DbMemory;
|
|
25
|
+
export default DbMemory;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("../../lib/utils");
|
|
5
|
-
class DbUptime extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
class DbUptime extends Command {
|
|
6
4
|
async run() {
|
|
7
|
-
|
|
8
|
-
let response = await
|
|
5
|
+
client.setConfig(this);
|
|
6
|
+
let response = await client.uptime();
|
|
9
7
|
if (response.status == 200) {
|
|
10
8
|
this.log(response.data.results);
|
|
11
9
|
this.exit();
|
|
12
10
|
}
|
|
13
11
|
}
|
|
12
|
+
static description = "Get database uptime";
|
|
13
|
+
static examples = [`$ legispro db:uptime`,];
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
DbUptime.examples = [`$ legispro db:uptime`,];
|
|
17
|
-
exports.default = DbUptime;
|
|
15
|
+
export default DbUptime;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const utils_1 = require("../../lib/utils");
|
|
5
|
-
class DbVersion extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import { client } from "../../lib/utils.js";
|
|
3
|
+
class DbVersion extends Command {
|
|
6
4
|
async run() {
|
|
7
|
-
|
|
8
|
-
let response = await
|
|
5
|
+
client.setConfig(this);
|
|
6
|
+
let response = await client.get("/version");
|
|
9
7
|
if (response.status == 200) {
|
|
10
8
|
this.log(JSON.stringify(response.data, null, 2));
|
|
11
9
|
this.exit();
|
|
12
10
|
}
|
|
13
11
|
}
|
|
12
|
+
static description = "Get database version";
|
|
13
|
+
static examples = [`$ legispro db:version`,];
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
DbVersion.examples = [`$ legispro db:version`,];
|
|
17
|
-
exports.default = DbVersion;
|
|
15
|
+
export default DbVersion;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
export default class DeployPrepare extends Command {
|
|
3
|
+
static description: string;
|
|
4
|
+
static examples: string[];
|
|
5
|
+
static flags: {
|
|
6
|
+
installationPath: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
env: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
};
|
|
9
|
+
run(): Promise<void>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import enquirer from 'enquirer';
|
|
3
|
+
import { connect, downloadAsset, listReleases } from '../../lib/gh.js';
|
|
4
|
+
import { copySources } from '../../lib/shell.js';
|
|
5
|
+
import { NodeSSH } from 'node-ssh';
|
|
6
|
+
import path from 'path';
|
|
7
|
+
import fs from 'fs-extra';
|
|
8
|
+
const ENV_OPTIONS = ['ola-dev', 'ola-qa'];
|
|
9
|
+
export default class DeployPrepare extends Command {
|
|
10
|
+
static description = 'Executes a docker deployment';
|
|
11
|
+
static examples = [`<%= config.bin %> <%= command.id %>`];
|
|
12
|
+
static flags = {
|
|
13
|
+
installationPath: Flags.string({
|
|
14
|
+
description: 'Server installation path',
|
|
15
|
+
char: 'p',
|
|
16
|
+
default: 'C:/legispro/deploy/',
|
|
17
|
+
}),
|
|
18
|
+
env: Flags.string({
|
|
19
|
+
description: 'Environment variables file',
|
|
20
|
+
char: 'e',
|
|
21
|
+
options: ENV_OPTIONS
|
|
22
|
+
})
|
|
23
|
+
};
|
|
24
|
+
async run() {
|
|
25
|
+
const { flags } = await this.parse(DeployPrepare);
|
|
26
|
+
let env = {};
|
|
27
|
+
try {
|
|
28
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
29
|
+
env = JSON.parse(fs.readFileSync(configFile, 'utf-8'));
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
/* Nothing to do */
|
|
33
|
+
env = {};
|
|
34
|
+
}
|
|
35
|
+
if (!env.gitToken || !env.gitRepository) {
|
|
36
|
+
const tokenPrompt = await enquirer.prompt([{
|
|
37
|
+
type: 'password',
|
|
38
|
+
name: 'gitToken',
|
|
39
|
+
message: 'Git token',
|
|
40
|
+
initial: env.gitToken,
|
|
41
|
+
required: true,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
type: 'input',
|
|
45
|
+
name: 'gitRepository',
|
|
46
|
+
message: 'Git repository',
|
|
47
|
+
initial: env.gitRepository,
|
|
48
|
+
required: true
|
|
49
|
+
}]);
|
|
50
|
+
env.gitToken = tokenPrompt.gitToken;
|
|
51
|
+
env.gitRepository = tokenPrompt.gitRepository;
|
|
52
|
+
}
|
|
53
|
+
if (!env.deploymentSSHAccount || !env.deploymentSSHPassword) {
|
|
54
|
+
const tokenPrompt = await enquirer.prompt([{
|
|
55
|
+
type: 'input',
|
|
56
|
+
name: 'deploymentSSHAccount',
|
|
57
|
+
message: 'SSH account'
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
type: 'password',
|
|
61
|
+
name: 'deploymentSSHPassword',
|
|
62
|
+
message: 'SSH password'
|
|
63
|
+
}]);
|
|
64
|
+
env.deploymentSSHAccount = tokenPrompt.deploymentSSHAccount;
|
|
65
|
+
env.deploymentSSHPassword = tokenPrompt.deploymentSSHPassword;
|
|
66
|
+
}
|
|
67
|
+
if (!flags.env) {
|
|
68
|
+
const envPrompt = await enquirer.prompt({
|
|
69
|
+
type: 'select',
|
|
70
|
+
name: 'env',
|
|
71
|
+
message: 'Select your environment',
|
|
72
|
+
choices: ENV_OPTIONS
|
|
73
|
+
});
|
|
74
|
+
flags.env = envPrompt.env;
|
|
75
|
+
}
|
|
76
|
+
const oktokit = await connect(env.gitToken);
|
|
77
|
+
const { data, releases } = await listReleases(oktokit, env.gitRepository);
|
|
78
|
+
const { tag } = await enquirer.prompt({
|
|
79
|
+
type: 'select',
|
|
80
|
+
name: 'tag',
|
|
81
|
+
message: 'Select your tag',
|
|
82
|
+
choices: releases
|
|
83
|
+
});
|
|
84
|
+
let host1, host2;
|
|
85
|
+
switch (flags.env) {
|
|
86
|
+
case 'ola-dev':
|
|
87
|
+
host1 = 'legddocker01';
|
|
88
|
+
host2 = 'legddocker02';
|
|
89
|
+
break;
|
|
90
|
+
case 'ola-qa':
|
|
91
|
+
host1 = 'dpmsdocktest01';
|
|
92
|
+
host2 = 'dpmsdocktest02';
|
|
93
|
+
break;
|
|
94
|
+
}
|
|
95
|
+
const release = data.find(i => i.tag_name === tag);
|
|
96
|
+
const { sourcesDir, tmpPath } = await downloadAsset(oktokit, env.gitRepository, release);
|
|
97
|
+
console.log(`Extracting to ${sourcesDir}`);
|
|
98
|
+
const { localDir, cwd, scpPath, dockerCmdLegispro, dockerCmdDpms } = await copySources({ print: !env.deploymentSSHPassword, user: env.deploymentSSHAccount || 'USERNAME', tmpPath, sourcesDir, env: flags.env, installationFolder: flags.installationPath });
|
|
99
|
+
const ssh1 = new NodeSSH();
|
|
100
|
+
console.log('Connecting to server 01');
|
|
101
|
+
await ssh1.connect({ host: host1, username: env.deploymentSSHAccount, password: env.deploymentSSHPassword });
|
|
102
|
+
console.log('Make installation folder');
|
|
103
|
+
await ssh1.mkdir(scpPath);
|
|
104
|
+
console.log('Putting assets');
|
|
105
|
+
await ssh1.putDirectory(localDir, scpPath);
|
|
106
|
+
console.log('Docker compose up');
|
|
107
|
+
console.log(dockerCmdLegispro);
|
|
108
|
+
const { stdout: out1, stderr: err1 } = await ssh1.execCommand(`cd ${cwd} && ${dockerCmdLegispro}`);
|
|
109
|
+
console.log(out1);
|
|
110
|
+
console.error(err1);
|
|
111
|
+
const ssh2 = new NodeSSH();
|
|
112
|
+
console.log('Connecting to server 02');
|
|
113
|
+
await ssh2.connect({ host: host2, username: env.deploymentSSHAccount, password: env.deploymentSSHPassword });
|
|
114
|
+
console.log('Make installation folder');
|
|
115
|
+
await ssh2.mkdir(scpPath);
|
|
116
|
+
console.log('Putting assets');
|
|
117
|
+
await ssh2.putDirectory(localDir, scpPath);
|
|
118
|
+
console.log('Docker compose up');
|
|
119
|
+
console.log(dockerCmdDpms);
|
|
120
|
+
const { stdout: out2, stderr: err2 } = await ssh2.execCommand(`cd ${cwd} && ${dockerCmdDpms}`);
|
|
121
|
+
console.log(out2);
|
|
122
|
+
console.error(err2);
|
|
123
|
+
console.log(`Installation completed`);
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -1,26 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const rclone = require("rclone.js").promises;
|
|
9
|
-
class DocumentCopy extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { client } from "../../lib/utils.js";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import rclone from "rclone.js";
|
|
6
|
+
class DocumentCopy extends Command {
|
|
10
7
|
async run() {
|
|
11
|
-
const configFile =
|
|
8
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
12
9
|
const env = require(configFile);
|
|
13
|
-
|
|
10
|
+
client.setConfig(this);
|
|
14
11
|
let source = '/db/repository/demo';
|
|
15
12
|
let dest = '/home/bmckinney/rclone-tests/demo';
|
|
16
13
|
// check if source exists
|
|
17
|
-
let exists = await
|
|
14
|
+
let exists = await client.existsCollection(source);
|
|
18
15
|
if (!exists) {
|
|
19
|
-
this.log(`Collection: ${
|
|
16
|
+
this.log(`Collection: ${chalk.magenta("repository")} not found.`);
|
|
20
17
|
this.exit();
|
|
21
18
|
}
|
|
22
|
-
let obscured_password = await rclone.obscure(env.password);
|
|
23
|
-
let copy_response = await rclone.copy(":webdav:" + source, dest, {
|
|
19
|
+
let obscured_password = await rclone.promises.obscure(env.password);
|
|
20
|
+
let copy_response = await rclone.promises.copy(":webdav:" + source, dest, {
|
|
24
21
|
"webdav-url": env.protocol + "://" + env.hostname + ":" + env.port + "/exist/webdav/",
|
|
25
22
|
"webdav-user": env.user,
|
|
26
23
|
"webdav-pass": obscured_password
|
|
@@ -29,7 +26,7 @@ class DocumentCopy extends core_1.Command {
|
|
|
29
26
|
//console.log(copy_response.toString());
|
|
30
27
|
this.exit();
|
|
31
28
|
}
|
|
29
|
+
static description = "List documents";
|
|
30
|
+
static examples = [`$ legispro document:list`,];
|
|
32
31
|
}
|
|
33
|
-
|
|
34
|
-
DocumentCopy.examples = [`$ legispro document:list`,];
|
|
35
|
-
exports.default = DocumentCopy;
|
|
32
|
+
export default DocumentCopy;
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const path_1 = tslib_1.__importDefault(require("path"));
|
|
8
|
-
const rclone = require("rclone.js").promises;
|
|
9
|
-
class DocumentList extends core_1.Command {
|
|
1
|
+
import { Command } from '@oclif/core';
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { client } from "../../lib/utils.js";
|
|
4
|
+
import path from "path";
|
|
5
|
+
import rclone from "rclone.js";
|
|
6
|
+
class DocumentList extends Command {
|
|
10
7
|
async run() {
|
|
11
|
-
const configFile =
|
|
8
|
+
const configFile = path.join(this.config.configDir, 'config.json');
|
|
12
9
|
const env = require(configFile);
|
|
13
|
-
|
|
10
|
+
client.setConfig(this);
|
|
14
11
|
let uri = '/db/repository';
|
|
15
12
|
// check if collection exists
|
|
16
|
-
let exists = await
|
|
13
|
+
let exists = await client.existsCollection(uri);
|
|
17
14
|
if (!exists) {
|
|
18
|
-
this.log(`Collection: ${
|
|
15
|
+
this.log(`Collection: ${chalk.magenta("repository")} not found.`);
|
|
19
16
|
this.exit();
|
|
20
17
|
}
|
|
21
|
-
let obscured_password = await rclone.obscure(env.password);
|
|
22
|
-
let list_response = await rclone.ls(":webdav:" + uri, {
|
|
18
|
+
let obscured_password = await rclone.promises.obscure(env.password);
|
|
19
|
+
let list_response = await rclone.promises.ls(":webdav:" + uri, {
|
|
23
20
|
"webdav-url": env.protocol + "://" + env.hostname + ":" + env.port + "/exist/webdav/",
|
|
24
21
|
"webdav-user": env.user,
|
|
25
22
|
"webdav-pass": obscured_password,
|
|
@@ -28,7 +25,7 @@ class DocumentList extends core_1.Command {
|
|
|
28
25
|
console.log(list_response.toString());
|
|
29
26
|
this.exit();
|
|
30
27
|
}
|
|
28
|
+
static description = "List documents";
|
|
29
|
+
static examples = [`$ legispro document:list`,];
|
|
31
30
|
}
|
|
32
|
-
|
|
33
|
-
DocumentList.examples = [`$ legispro document:list`,];
|
|
34
|
-
exports.default = DocumentList;
|
|
31
|
+
export default DocumentList;
|
|
@@ -2,11 +2,11 @@ import { Command } from '@oclif/core';
|
|
|
2
2
|
declare class GroupCreate extends Command {
|
|
3
3
|
run(): Promise<void>;
|
|
4
4
|
static flags: {
|
|
5
|
-
name: import("@oclif/core/
|
|
6
|
-
managers: import("@oclif/core/
|
|
7
|
-
email: import("@oclif/core/
|
|
8
|
-
language: import("@oclif/core/
|
|
9
|
-
description: import("@oclif/core/
|
|
5
|
+
name: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
+
managers: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
+
email: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
|
+
language: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
9
|
+
description: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
10
10
|
};
|
|
11
11
|
static description: string;
|
|
12
12
|
static examples: string[];
|