occam-open-cli 6.0.144 → 6.0.146
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/bin/action/help.js +1 -1
- package/bin/configuration.js +15 -12
- package/bin/configure.js +25 -8
- package/bin/main.js +11 -15
- package/bin/messages.js +3 -1
- package/package.json +1 -1
package/bin/action/help.js
CHANGED
package/bin/configuration.js
CHANGED
|
@@ -14,7 +14,7 @@ const { rc } = configurationUtilities,
|
|
|
14
14
|
{ migrate } = versionUtilities,
|
|
15
15
|
{ setRCBaseExtension, checkRCFileExists, updateRCFile, writeRCFile, readRCFile } = rc;
|
|
16
16
|
|
|
17
|
-
const rcBaseExtension = OPEN;
|
|
17
|
+
const rcBaseExtension = OPEN; ///
|
|
18
18
|
|
|
19
19
|
setRCBaseExtension(rcBaseExtension);
|
|
20
20
|
|
|
@@ -76,6 +76,8 @@ function createConfigurationFile() {
|
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
function migrateConfigurationFile() {
|
|
79
|
+
assertConfigurationFileExists();
|
|
80
|
+
|
|
79
81
|
let json = readRCFile();
|
|
80
82
|
|
|
81
83
|
const migrationMap = {
|
|
@@ -97,6 +99,16 @@ function checkConfigurationFileExists() {
|
|
|
97
99
|
return configurationFileExists;
|
|
98
100
|
}
|
|
99
101
|
|
|
102
|
+
function assertConfigurationFileExists() {
|
|
103
|
+
const configurationFileExists = checkConfigurationFileExists();
|
|
104
|
+
|
|
105
|
+
if (!configurationFileExists) {
|
|
106
|
+
console.log(CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE);
|
|
107
|
+
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
100
112
|
module.exports = {
|
|
101
113
|
retrieveHost,
|
|
102
114
|
retrieveOptions,
|
|
@@ -108,7 +120,8 @@ module.exports = {
|
|
|
108
120
|
removeIdentityToken,
|
|
109
121
|
createConfigurationFile,
|
|
110
122
|
migrateConfigurationFile,
|
|
111
|
-
checkConfigurationFileExists
|
|
123
|
+
checkConfigurationFileExists,
|
|
124
|
+
assertConfigurationFileExists
|
|
112
125
|
};
|
|
113
126
|
|
|
114
127
|
function readConfigurationFile() {
|
|
@@ -136,13 +149,3 @@ function updateConfigurationFile(addedConfiguration, ...deleteConfigurationNames
|
|
|
136
149
|
|
|
137
150
|
updateRCFile(addedProperties, ...deletedPropertyNames);
|
|
138
151
|
}
|
|
139
|
-
|
|
140
|
-
function assertConfigurationFileExists() {
|
|
141
|
-
const configurationFileExists = checkConfigurationFileExists();
|
|
142
|
-
|
|
143
|
-
if (!configurationFileExists) {
|
|
144
|
-
console.log(CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE);
|
|
145
|
-
|
|
146
|
-
process.exit();
|
|
147
|
-
}
|
|
148
|
-
}
|
package/bin/configure.js
CHANGED
|
@@ -3,16 +3,35 @@
|
|
|
3
3
|
const { pathUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const { DOUBLE_DOTS } = require("./constants"),
|
|
6
|
-
{
|
|
7
|
-
{
|
|
6
|
+
{ DEFAULT_HELP, DEFAULT_VERSION } = require("./defaults"),
|
|
7
|
+
{ HELP_COMMAND, VERSION_COMMAND, PUBLISH_COMMAND } = require("./commands"),
|
|
8
|
+
{ migrateConfigurationFile, checkConfigurationFileExists } = require("./configuration");
|
|
8
9
|
|
|
9
10
|
const { bottommostNameFromPath } = pathUtilities;
|
|
10
11
|
|
|
11
12
|
function configure(command, argument, options, main) {
|
|
12
|
-
let configurationFileExists
|
|
13
|
+
let configurationFileExists;
|
|
13
14
|
|
|
14
|
-
|
|
15
|
-
|
|
15
|
+
const { help = DEFAULT_HELP, version = DEFAULT_VERSION } = options;
|
|
16
|
+
|
|
17
|
+
if (false) {
|
|
18
|
+
///
|
|
19
|
+
} else if (help) {
|
|
20
|
+
command = HELP_COMMAND;
|
|
21
|
+
} else if (version) {
|
|
22
|
+
command = VERSION_COMMAND;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
if ((command === HELP_COMMAND) || (command === VERSION_COMMAND)) {
|
|
26
|
+
main(command, argument, options);
|
|
27
|
+
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
configurationFileExists = checkConfigurationFileExists();
|
|
32
|
+
|
|
33
|
+
if (command === PUBLISH_COMMAND) {
|
|
34
|
+
if (!configurationFileExists) {
|
|
16
35
|
const currentWorkingDirectoryPath = process.cwd(); ///
|
|
17
36
|
|
|
18
37
|
process.chdir(DOUBLE_DOTS);
|
|
@@ -29,9 +48,7 @@ function configure(command, argument, options, main) {
|
|
|
29
48
|
}
|
|
30
49
|
}
|
|
31
50
|
|
|
32
|
-
|
|
33
|
-
migrateConfigurationFile();
|
|
34
|
-
}
|
|
51
|
+
migrateConfigurationFile();
|
|
35
52
|
|
|
36
53
|
main(command, argument, options);
|
|
37
54
|
}
|
package/bin/main.js
CHANGED
|
@@ -14,7 +14,8 @@ const helpAction = require("./action/help"),
|
|
|
14
14
|
resetPasswordAction = require("./action/resetPassword"),
|
|
15
15
|
setShellCommandsAction = require("./action/setShellCommands");
|
|
16
16
|
|
|
17
|
-
const {
|
|
17
|
+
const { NO_COMMAND_GIVEN_MESSAGE } = require("./messages"),
|
|
18
|
+
{ DEFAULT_NO, DEFAULT_YES, DEFAULT_TAIL, DEFAULT_FOLLOW, DEFAULT_DRY_RUN, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
|
|
18
19
|
{ HELP_COMMAND,
|
|
19
20
|
OPEN_COMMAND,
|
|
20
21
|
CLONE_COMMAND,
|
|
@@ -30,28 +31,23 @@ const { DEFAULT_NO, DEFAULT_YES, DEFAULT_HELP, DEFAULT_TAIL, DEFAULT_FOLLOW, DEF
|
|
|
30
31
|
SET_SHELL_COMMANDS_COMMAND } = require("./commands");
|
|
31
32
|
|
|
32
33
|
function main(command, argument, options) {
|
|
33
|
-
const
|
|
34
|
-
{ no = DEFAULT_NO,
|
|
34
|
+
const { no = DEFAULT_NO,
|
|
35
35
|
yes = DEFAULT_YES,
|
|
36
|
-
help = DEFAULT_HELP,
|
|
37
36
|
tail = DEFAULT_TAIL,
|
|
38
37
|
follow = DEFAULT_FOLLOW,
|
|
39
38
|
dryRun = DEFAULT_DRY_RUN,
|
|
40
|
-
version = DEFAULT_VERSION,
|
|
41
39
|
quietly = DEFAULT_QUIETLY,
|
|
42
40
|
logLevel = DEFAULT_LOG_LEVEL } = options;
|
|
43
41
|
|
|
44
|
-
if (false) {
|
|
45
|
-
///
|
|
46
|
-
} else if (help) {
|
|
47
|
-
command = HELP_COMMAND;
|
|
48
|
-
} else if (version) {
|
|
49
|
-
command = VERSION_COMMAND;
|
|
50
|
-
} else if (commandMissing) {
|
|
51
|
-
command = HELP_COMMAND;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
42
|
switch (command) {
|
|
43
|
+
case null: {
|
|
44
|
+
console.log(NO_COMMAND_GIVEN_MESSAGE);
|
|
45
|
+
|
|
46
|
+
process.exit(1);
|
|
47
|
+
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
55
51
|
case HELP_COMMAND: {
|
|
56
52
|
helpAction();
|
|
57
53
|
|
package/bin/messages.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const NO_COMMAND_GIVEN_MESSAGE = "No command has been given.",
|
|
4
|
+
PASSWORDS_DO_NOT_MATCH_MESSAGE = "The passwords do not match.",
|
|
4
5
|
SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE = "The server did not respond in a timely or intelligible fashion. If this problem persists then please be kind enough to report it.",
|
|
5
6
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE = "The action cannot be performed because the configuration file is missing. Run 'open initialise' to create one.",
|
|
6
7
|
SIGN_OUT_MESSAGE = "You have been signed out.",
|
|
@@ -28,6 +29,7 @@ const PASSWORDS_DO_NOT_MATCH_MESSAGE = "The passwords do not match.",
|
|
|
28
29
|
SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE = "The shell commands have been set successfully.";
|
|
29
30
|
|
|
30
31
|
module.exports = {
|
|
32
|
+
NO_COMMAND_GIVEN_MESSAGE,
|
|
31
33
|
PASSWORDS_DO_NOT_MATCH_MESSAGE,
|
|
32
34
|
SERVER_FAILED_TO_RESPOND_ERROR_MESSAGE,
|
|
33
35
|
CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE,
|
package/package.json
CHANGED