occam-open-cli 5.1.0 → 5.1.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/README.md +2 -0
- package/bin/action/help.js +2 -0
- package/bin/action/publish.js +3 -1
- package/bin/action/setShellCommands.js +33 -0
- package/bin/actions.js +5 -2
- package/bin/commands.js +4 -2
- package/bin/configuration/version_5_1.js +38 -0
- package/bin/configuration.js +41 -21
- package/bin/defaults.js +4 -0
- package/bin/descriptions.js +2 -0
- package/bin/messages.js +6 -2
- package/bin/operation/clone.old.js +2 -2
- package/bin/operation/cloneReleases.js +2 -2
- package/bin/operation/executeShallCommands.js +20 -0
- package/bin/operation/getIdentityToken.js +2 -2
- package/bin/operation/prompt/setShellCommands.js +34 -0
- package/bin/operation/setIdentityToken.js +2 -2
- package/bin/operation/setOptions.js +2 -2
- package/bin/post.js +2 -2
- package/bin/utilities/validate.js +3 -0
- package/bin/versions.js +3 -1
- package/package.json +2 -2
package/README.md
CHANGED
package/bin/action/help.js
CHANGED
package/bin/action/publish.js
CHANGED
|
@@ -5,6 +5,7 @@ const publishOperation = require("../operation/publish"),
|
|
|
5
5
|
packReleaseOperation = require("../operation/packRelease"),
|
|
6
6
|
getIdentityTokenOperation = require("../operation/getIdentityToken"),
|
|
7
7
|
releaseNamePromptOperation = require("../operation/prompt/releaseName"),
|
|
8
|
+
executeShellCommandsOperation = require("../operation/executeShallCommands"),
|
|
8
9
|
updateMetaJSONFileVersionOperation = require("../operation/updateMetaJSONFileVersion");
|
|
9
10
|
|
|
10
11
|
const { DOUBLE_DASH } = require("../constants"),
|
|
@@ -20,7 +21,8 @@ function publishAction(argument, dryRun, logLevel) {
|
|
|
20
21
|
loadProjectOperation,
|
|
21
22
|
packReleaseOperation,
|
|
22
23
|
publishOperation,
|
|
23
|
-
updateMetaJSONFileVersionOperation
|
|
24
|
+
updateMetaJSONFileVersionOperation,
|
|
25
|
+
executeShellCommandsOperation
|
|
24
26
|
],
|
|
25
27
|
success = false,
|
|
26
28
|
context = {
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const setShellCommandsPromptOperation = require("../operation/prompt/setShellCommands");
|
|
4
|
+
|
|
5
|
+
const { executeOperations } = require("../utilities/operation"),
|
|
6
|
+
{ retrieveShellCommands, updateShellCommands } = require("../configuration"),
|
|
7
|
+
{ FAILED_SET_SHELL_COMMANDS_MESSAGE, SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE } = require("../messages");
|
|
8
|
+
|
|
9
|
+
function setShellCommandsAction() {
|
|
10
|
+
const operations = [
|
|
11
|
+
setShellCommandsPromptOperation
|
|
12
|
+
],
|
|
13
|
+
shellCommands = retrieveShellCommands(),
|
|
14
|
+
context = {
|
|
15
|
+
shellCommands
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
executeOperations(operations, (completed) => {
|
|
19
|
+
if (!completed) {
|
|
20
|
+
console.log(FAILED_SET_SHELL_COMMANDS_MESSAGE);
|
|
21
|
+
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const { shellCommands } = context;
|
|
26
|
+
|
|
27
|
+
updateShellCommands(shellCommands);
|
|
28
|
+
|
|
29
|
+
console.log(SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE);
|
|
30
|
+
}, context);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
module.exports = setShellCommandsAction;
|
package/bin/actions.js
CHANGED
|
@@ -11,7 +11,8 @@ const helpAction = require("./action/help"),
|
|
|
11
11
|
initialiseAction = require("./action/initialise"),
|
|
12
12
|
setOptionsAction = require("./action/setOptions"),
|
|
13
13
|
createAccountAction = require("./action/createAccount"),
|
|
14
|
-
resetPasswordAction = require("./action/resetPassword")
|
|
14
|
+
resetPasswordAction = require("./action/resetPassword"),
|
|
15
|
+
setShellCommandsAction = require("./action/setShellCommands");
|
|
15
16
|
|
|
16
17
|
const { DEFAULT_NO, DEFAULT_YES, DEFAULT_HELP, DEFAULT_DRY_RUN, DEFAULT_VERSION, DEFAULT_QUIETLY, DEFAULT_LOG_LEVEL } = require("./defaults"),
|
|
17
18
|
{ HELP_COMMAND,
|
|
@@ -25,7 +26,8 @@ const { DEFAULT_NO, DEFAULT_YES, DEFAULT_HELP, DEFAULT_DRY_RUN, DEFAULT_VERSION,
|
|
|
25
26
|
INITIALISE_COMMAND,
|
|
26
27
|
SET_OPTIONS_COMMAND,
|
|
27
28
|
CREATE_ACCOUNT_COMMAND,
|
|
28
|
-
RESET_PASSWORD_COMMAND
|
|
29
|
+
RESET_PASSWORD_COMMAND,
|
|
30
|
+
SET_SHELL_COMMANDS_COMMAND } = require("./commands");
|
|
29
31
|
|
|
30
32
|
function actions(command, argument, options) {
|
|
31
33
|
const commandMissing = (command === null),
|
|
@@ -60,6 +62,7 @@ function actions(command, argument, options) {
|
|
|
60
62
|
case SET_OPTIONS_COMMAND : setOptionsAction(); break;
|
|
61
63
|
case CREATE_ACCOUNT_COMMAND : createAccountAction(argument); break;
|
|
62
64
|
case RESET_PASSWORD_COMMAND : resetPasswordAction(argument); break;
|
|
65
|
+
case SET_SHELL_COMMANDS_COMMAND : setShellCommandsAction(); break;
|
|
63
66
|
|
|
64
67
|
default:
|
|
65
68
|
argument = command; ///
|
package/bin/commands.js
CHANGED
|
@@ -11,7 +11,8 @@ const HELP_COMMAND = "help",
|
|
|
11
11
|
INITIALISE_COMMAND = "initialise",
|
|
12
12
|
SET_OPTIONS_COMMAND = "set-options",
|
|
13
13
|
CREATE_ACCOUNT_COMMAND = "create-account",
|
|
14
|
-
RESET_PASSWORD_COMMAND = "reset-password"
|
|
14
|
+
RESET_PASSWORD_COMMAND = "reset-password",
|
|
15
|
+
SET_SHELL_COMMANDS_COMMAND = "set-shell-commands";
|
|
15
16
|
|
|
16
17
|
module.exports = {
|
|
17
18
|
HELP_COMMAND,
|
|
@@ -25,5 +26,6 @@ module.exports = {
|
|
|
25
26
|
INITIALISE_COMMAND,
|
|
26
27
|
SET_OPTIONS_COMMAND,
|
|
27
28
|
CREATE_ACCOUNT_COMMAND,
|
|
28
|
-
RESET_PASSWORD_COMMAND
|
|
29
|
+
RESET_PASSWORD_COMMAND,
|
|
30
|
+
SET_SHELL_COMMANDS_COMMAND
|
|
29
31
|
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { VERSION_5_1 } = require("../versions"),
|
|
4
|
+
{ DEFAULT_HOST, DEFAULT_SHELL_COMMANDS } = require("../defaults");
|
|
5
|
+
|
|
6
|
+
function createConfiguration() {
|
|
7
|
+
const version = VERSION_5_1,
|
|
8
|
+
host = DEFAULT_HOST,
|
|
9
|
+
options = {},
|
|
10
|
+
shellCommands = DEFAULT_SHELL_COMMANDS,
|
|
11
|
+
identityToken = null,
|
|
12
|
+
configuration = {
|
|
13
|
+
version,
|
|
14
|
+
host,
|
|
15
|
+
options,
|
|
16
|
+
shellCommands,
|
|
17
|
+
identityToken
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
return configuration;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function migrateConfigurationToVersion_5_1(configuration) {
|
|
24
|
+
const version = VERSION_5_1,
|
|
25
|
+
shellCommands = DEFAULT_SHELL_COMMANDS;
|
|
26
|
+
|
|
27
|
+
Object.assign(configuration, {
|
|
28
|
+
version,
|
|
29
|
+
shellCommands
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
return configuration;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
module.exports = {
|
|
36
|
+
createConfiguration,
|
|
37
|
+
migrateConfigurationToVersion_5_1
|
|
38
|
+
};
|
package/bin/configuration.js
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
const { configurationUtilities } = require("necessary");
|
|
4
4
|
|
|
5
5
|
const { OPEN } = require("./constants"),
|
|
6
|
-
{ CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } = require("./messages"),
|
|
7
6
|
{ migrateConfigurationToVersion_1_5 } = require("./configuration/version_1_5"),
|
|
8
7
|
{ migrateConfigurationToVersion_2_0 } = require("./configuration/version_2_0"),
|
|
9
|
-
{
|
|
10
|
-
{
|
|
8
|
+
{ migrateConfigurationToVersion_5_0 } = require("./configuration/version_5_0"),
|
|
9
|
+
{ CONFIGURATION_FILE_DOES_NOT_EXIST_MESSAGE } = require("./messages"),
|
|
10
|
+
{ migrateConfigurationToVersion_5_1, createConfiguration } = require("./configuration/version_5_1"),
|
|
11
|
+
{ UNVERSIONED, VERSION_1_5, VERSION_2_0, VERSION_5_0, CURRENT_VERSION } = require("./versions");
|
|
11
12
|
|
|
12
13
|
const { rc } = configurationUtilities,
|
|
13
14
|
{ setRCBaseExtension, checkRCFileExists, updateRCFile, writeRCFile, readRCFile } = rc;
|
|
@@ -16,34 +17,47 @@ const rcBaseExtension = OPEN;
|
|
|
16
17
|
|
|
17
18
|
setRCBaseExtension(rcBaseExtension);
|
|
18
19
|
|
|
19
|
-
function
|
|
20
|
+
function retrieveHost() {
|
|
20
21
|
const configuration = readConfigurationFile(),
|
|
21
22
|
{ host } = configuration;
|
|
22
23
|
|
|
23
24
|
return host;
|
|
24
25
|
}
|
|
25
26
|
|
|
26
|
-
function
|
|
27
|
+
function retrieveOptions() {
|
|
27
28
|
const configuration = readConfigurationFile(),
|
|
28
29
|
{ options } = configuration;
|
|
29
30
|
|
|
30
31
|
return options;
|
|
31
32
|
}
|
|
32
33
|
|
|
33
|
-
function
|
|
34
|
+
function retrieveShellCommands() {
|
|
35
|
+
const configuration = readConfigurationFile(),
|
|
36
|
+
{ shellCommands } = configuration;
|
|
37
|
+
|
|
38
|
+
return shellCommands;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function retrieveIdentityToken() {
|
|
34
42
|
const configuration = readConfigurationFile(),
|
|
35
43
|
{ identityToken } = configuration;
|
|
36
44
|
|
|
37
45
|
return identityToken;
|
|
38
46
|
}
|
|
39
47
|
|
|
40
|
-
function
|
|
48
|
+
function updateOptions(options) {
|
|
41
49
|
updateConfigurationFile({
|
|
42
50
|
options
|
|
43
51
|
});
|
|
44
52
|
}
|
|
45
53
|
|
|
46
|
-
function
|
|
54
|
+
function updateShellCommands(shellCommands) {
|
|
55
|
+
updateConfigurationFile({
|
|
56
|
+
shellCommands
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
function updateIdentityToken(identityToken) {
|
|
47
61
|
updateConfigurationFile({
|
|
48
62
|
identityToken
|
|
49
63
|
});
|
|
@@ -61,30 +75,34 @@ function createConfigurationFile() {
|
|
|
61
75
|
}
|
|
62
76
|
|
|
63
77
|
function migrateConfigurationFile() {
|
|
64
|
-
let
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
let configuration = json; ///
|
|
69
|
-
|
|
70
|
-
version = configuration.version || UNVERSIONED; ///
|
|
78
|
+
let json = readRCFile(),
|
|
79
|
+
configuration = json, ///
|
|
80
|
+
{ version = UNVERSIONED } = configuration;
|
|
71
81
|
|
|
72
82
|
while (version !== CURRENT_VERSION) {
|
|
73
83
|
switch (version) {
|
|
74
84
|
case UNVERSIONED :
|
|
75
85
|
configuration = migrateConfigurationToVersion_1_5(configuration);
|
|
86
|
+
|
|
76
87
|
break;
|
|
77
88
|
|
|
78
89
|
case VERSION_1_5 :
|
|
79
90
|
configuration = migrateConfigurationToVersion_2_0(configuration);
|
|
91
|
+
|
|
80
92
|
break;
|
|
81
93
|
|
|
82
94
|
case VERSION_2_0 :
|
|
83
95
|
configuration = migrateConfigurationToVersion_5_0(configuration);
|
|
96
|
+
|
|
97
|
+
break;
|
|
98
|
+
|
|
99
|
+
case VERSION_5_0 :
|
|
100
|
+
configuration = migrateConfigurationToVersion_5_1(configuration);
|
|
101
|
+
|
|
84
102
|
break;
|
|
85
103
|
}
|
|
86
104
|
|
|
87
|
-
version = configuration
|
|
105
|
+
({ version } = configuration);
|
|
88
106
|
}
|
|
89
107
|
|
|
90
108
|
json = configuration; ///
|
|
@@ -100,11 +118,13 @@ function checkConfigurationFileExists() {
|
|
|
100
118
|
}
|
|
101
119
|
|
|
102
120
|
module.exports = {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
121
|
+
retrieveHost,
|
|
122
|
+
retrieveOptions,
|
|
123
|
+
retrieveShellCommands,
|
|
124
|
+
retrieveIdentityToken,
|
|
125
|
+
updateOptions,
|
|
126
|
+
updateShellCommands,
|
|
127
|
+
updateIdentityToken,
|
|
108
128
|
removeIdentityToken,
|
|
109
129
|
createConfigurationFile,
|
|
110
130
|
migrateConfigurationFile,
|
package/bin/defaults.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const { levels } = require("necessary");
|
|
4
4
|
|
|
5
|
+
const { EMPTY_STRING } = require("./constants");
|
|
6
|
+
|
|
5
7
|
const { INFO_LEVEL } = levels;
|
|
6
8
|
|
|
7
9
|
const DEFAULT_NO = false,
|
|
@@ -12,6 +14,7 @@ const DEFAULT_NO = false,
|
|
|
12
14
|
DEFAULT_VERSION = false,
|
|
13
15
|
DEFAULT_QUIETLY = false,
|
|
14
16
|
DEFAULT_LOG_LEVEL = INFO_LEVEL,
|
|
17
|
+
DEFAULT_SHELL_COMMANDS = EMPTY_STRING,
|
|
15
18
|
DEFAULT_GITHUB_HOST_NAME = "github.com";
|
|
16
19
|
|
|
17
20
|
module.exports = {
|
|
@@ -23,5 +26,6 @@ module.exports = {
|
|
|
23
26
|
DEFAULT_VERSION,
|
|
24
27
|
DEFAULT_QUIETLY,
|
|
25
28
|
DEFAULT_LOG_LEVEL,
|
|
29
|
+
DEFAULT_SHELL_COMMANDS,
|
|
26
30
|
DEFAULT_GITHUB_HOST_NAME
|
|
27
31
|
};
|
package/bin/descriptions.js
CHANGED
|
@@ -6,6 +6,7 @@ const USE_SSH_DESCRIPTION = "Use SSH when cloning: ",
|
|
|
6
6
|
RELEASE_NAME_DESCRIPTION = "Package name: ", ///
|
|
7
7
|
ARE_YOU_SURE_DESCRIPTION = "Are you sure? (y)es (n)o: ",
|
|
8
8
|
EMAIL_ADDRESS_DESCRIPTION = "Email address: ",
|
|
9
|
+
SHELL_COMMANDS_DESCRIPTION = "Shell command(s) to run after successful publishing: ",
|
|
9
10
|
CONFIRM_PASSWORD_DESCRIPTION = "Confirm password: ",
|
|
10
11
|
GITHUB_HOST_NAME_DESCRIPTION = "GitHub host name (leave blank for default): ",
|
|
11
12
|
CLONE_DEPENDENCIES_DESCRIPTION = "Clone dependencies? (y)es (n)o: ",
|
|
@@ -18,6 +19,7 @@ module.exports = {
|
|
|
18
19
|
RELEASE_NAME_DESCRIPTION,
|
|
19
20
|
ARE_YOU_SURE_DESCRIPTION,
|
|
20
21
|
EMAIL_ADDRESS_DESCRIPTION,
|
|
22
|
+
SHELL_COMMANDS_DESCRIPTION,
|
|
21
23
|
CONFIRM_PASSWORD_DESCRIPTION,
|
|
22
24
|
GITHUB_HOST_NAME_DESCRIPTION,
|
|
23
25
|
CLONE_DEPENDENCIES_DESCRIPTION,
|
package/bin/messages.js
CHANGED
|
@@ -18,12 +18,14 @@ const PASSWORDS_DO_NOT_MATCH_MESSAGE = "The passwords do not match.",
|
|
|
18
18
|
FAILED_DEPRECATE_MESSAGE = "Failed to deprecate the package.",
|
|
19
19
|
FAILED_INITIALISE_MESSAGE = "Failed to create a configuration file because one is already present.",
|
|
20
20
|
FAILED_SET_OPTIONS_MESSAGE = "Failed to set the options.",
|
|
21
|
+
FAILED_SET_SHELL_COMMANDS_MESSAGE = "Failed to set the shell commands.",
|
|
21
22
|
SUCCESSFUL_OPEN_MESSAGE = "The package has been opened successfully.",
|
|
22
23
|
SUCCESSFUL_CLONE_MESSAGE = "The package has been cloned successfully.",
|
|
23
24
|
SUCCESSFUL_PUBLISH_MESSAGE = "The package has been published successfully.",
|
|
24
25
|
SUCCESSFUL_DEPRECATE_MESSAGE = "The package has been deprecated successfully.",
|
|
25
26
|
SUCCESSFUL_INITIALISE_MESSAGE = "The configuration file has been created successfully.",
|
|
26
|
-
SUCCESSFUL_SET_OPTIONS_MESSAGE = "The options have been set successfully."
|
|
27
|
+
SUCCESSFUL_SET_OPTIONS_MESSAGE = "The options have been set successfully.",
|
|
28
|
+
SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE = "The shell commands have been set successfully.";
|
|
27
29
|
|
|
28
30
|
module.exports = {
|
|
29
31
|
PASSWORDS_DO_NOT_MATCH_MESSAGE,
|
|
@@ -44,10 +46,12 @@ module.exports = {
|
|
|
44
46
|
FAILED_DEPRECATE_MESSAGE,
|
|
45
47
|
FAILED_INITIALISE_MESSAGE,
|
|
46
48
|
FAILED_SET_OPTIONS_MESSAGE,
|
|
49
|
+
FAILED_SET_SHELL_COMMANDS_MESSAGE,
|
|
47
50
|
SUCCESSFUL_OPEN_MESSAGE,
|
|
48
51
|
SUCCESSFUL_CLONE_MESSAGE,
|
|
49
52
|
SUCCESSFUL_PUBLISH_MESSAGE,
|
|
50
53
|
SUCCESSFUL_DEPRECATE_MESSAGE,
|
|
51
54
|
SUCCESSFUL_INITIALISE_MESSAGE,
|
|
52
|
-
SUCCESSFUL_SET_OPTIONS_MESSAGE
|
|
55
|
+
SUCCESSFUL_SET_OPTIONS_MESSAGE,
|
|
56
|
+
SUCCESSFUL_SET_SHELL_COMMANDS_MESSAGE
|
|
53
57
|
};
|
|
@@ -5,7 +5,7 @@ const { exec } = require("child_process"),
|
|
|
5
5
|
|
|
6
6
|
const { checkEntryExists } = fileSystemUtilities;
|
|
7
7
|
|
|
8
|
-
const {
|
|
8
|
+
const { retrieveOptions } = require("../configuration"),
|
|
9
9
|
{ DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
|
|
10
10
|
|
|
11
11
|
function cloneOperation(proceed, abort, context) {
|
|
@@ -27,7 +27,7 @@ function cloneOperation(proceed, abort, context) {
|
|
|
27
27
|
|
|
28
28
|
let { repository } = context;
|
|
29
29
|
|
|
30
|
-
const options =
|
|
30
|
+
const options = retrieveOptions(),
|
|
31
31
|
{ ssh } = options;
|
|
32
32
|
|
|
33
33
|
if (ssh) {
|
|
@@ -4,7 +4,7 @@ const { exec } = require("child_process"),
|
|
|
4
4
|
{ Entries } = require("occam-file-system"),
|
|
5
5
|
{ fileSystemUtilities, asynchronousUtilities } = require("necessary");
|
|
6
6
|
|
|
7
|
-
const {
|
|
7
|
+
const { retrieveOptions } = require("../configuration"),
|
|
8
8
|
{ DEFAULT_GITHUB_HOST_NAME } = require("../defaults");
|
|
9
9
|
|
|
10
10
|
const { checkEntryExists } = fileSystemUtilities;
|
|
@@ -53,7 +53,7 @@ function cloneReleasePromptOperation(release, next, done, context, index) {
|
|
|
53
53
|
function cloneRelease(release, quietly, done) {
|
|
54
54
|
let repository = repositoryFromRelease(release)
|
|
55
55
|
|
|
56
|
-
const options =
|
|
56
|
+
const options = retrieveOptions(),
|
|
57
57
|
{ ssh } = options;
|
|
58
58
|
|
|
59
59
|
if (ssh) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { EMPTY_STRING } = require("../constants");
|
|
4
|
+
const { retrieveShellCommands } = require("../configuration");
|
|
5
|
+
|
|
6
|
+
function executeShellCommandsOperation(proceed, abort, context) {
|
|
7
|
+
const { success } = context;
|
|
8
|
+
|
|
9
|
+
if (success) {
|
|
10
|
+
const shellCommands = retrieveShellCommands();
|
|
11
|
+
|
|
12
|
+
if (shellCommands !== EMPTY_STRING) {
|
|
13
|
+
debugger
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
proceed();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = executeShellCommandsOperation;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { retrieveIdentityToken } = require("../configuration");
|
|
4
4
|
|
|
5
5
|
function getIdentityTokenOperation(proceed, abort, context) {
|
|
6
|
-
const identityToken =
|
|
6
|
+
const identityToken = retrieveIdentityToken();
|
|
7
7
|
|
|
8
8
|
if (!identityToken) {
|
|
9
9
|
abort();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
const { shellUtilities } = require("necessary");
|
|
4
|
+
|
|
5
|
+
const { EMPTY_STRING } = require("../../constants"),
|
|
6
|
+
{ validateShellCommands } = require("../../utilities/validate"),
|
|
7
|
+
{ DEFAULT_SHELL_COMMANDS } = require("../../defaults"),
|
|
8
|
+
{ SHELL_COMMANDS_DESCRIPTION } = require("../../descriptions");
|
|
9
|
+
|
|
10
|
+
const { prompt } = shellUtilities;
|
|
11
|
+
|
|
12
|
+
function setShellCommandsPromptOperation(proceed, abort, context) {
|
|
13
|
+
const { shellCommands } = context,
|
|
14
|
+
initialAnswer = shellCommands, ///
|
|
15
|
+
validationFunction = validateShellCommands, ///
|
|
16
|
+
description = SHELL_COMMANDS_DESCRIPTION,
|
|
17
|
+
options = {
|
|
18
|
+
description,
|
|
19
|
+
initialAnswer,
|
|
20
|
+
validationFunction
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
prompt(options, (answer) => {
|
|
24
|
+
const shellCommands = answer; ///
|
|
25
|
+
|
|
26
|
+
Object.assign(context, {
|
|
27
|
+
shellCommands
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
proceed();
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = setShellCommandsPromptOperation;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { updateIdentityToken } = require("../configuration");
|
|
4
4
|
|
|
5
5
|
function setIdentityTokenOperation(proceed, abort, context) {
|
|
6
6
|
const { identityToken } = context;
|
|
7
7
|
|
|
8
8
|
if (identityToken !== null) {
|
|
9
|
-
|
|
9
|
+
updateIdentityToken(identityToken);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
proceed();
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
const {
|
|
3
|
+
const { updateOptions } = require("../configuration");
|
|
4
4
|
|
|
5
5
|
function setOptionsOperation(proceed, abort, context) {
|
|
6
6
|
const { useSSH } = context,
|
|
@@ -17,7 +17,7 @@ function setOptionsOperation(proceed, abort, context) {
|
|
|
17
17
|
});
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
-
|
|
20
|
+
updateOptions(options);
|
|
21
21
|
|
|
22
22
|
proceed();
|
|
23
23
|
}
|
package/bin/post.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
const { Readable } = require("stream"),
|
|
4
4
|
{ headers, contentTypes, statusCodes, requestUtilities } = require("necessary");
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const { retrieveHost } = require("./configuration"),
|
|
7
7
|
{ getPackageVersion } = require("./utilities/packageJSON"),
|
|
8
8
|
{ contentFromResponse } = require("./utilities/response"),
|
|
9
9
|
{ statusMessageFromStatusCode } = require("./utilities/status"),
|
|
@@ -15,7 +15,7 @@ const { createPostRequest } = requestUtilities,
|
|
|
15
15
|
{ APPLICATION_JSON_CHARSET_UTF_8_CONTENT_TYPE } = contentTypes;
|
|
16
16
|
|
|
17
17
|
function post(uri, json, callback) {
|
|
18
|
-
const host =
|
|
18
|
+
const host = retrieveHost(),
|
|
19
19
|
query = {},
|
|
20
20
|
headers = getHeaders(),
|
|
21
21
|
content = JSON.stringify(json), ///
|
|
@@ -12,6 +12,8 @@ function validateReleaseName(releaseName) { return /^[a-z0-9]{2,16}(?:-[a-z0-9]{
|
|
|
12
12
|
|
|
13
13
|
function validateEmailAddress(emailAddress) { return /^[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,16}$/.test(emailAddress); }
|
|
14
14
|
|
|
15
|
+
function validateShellCommands(shellCommands) { return /^.*$/.test(shellCommands); }
|
|
16
|
+
|
|
15
17
|
function validateGitHubHostName(gitHubHostName) { return /^[a-zA-Z0-9.\-]*$/.test(gitHubHostName); }
|
|
16
18
|
|
|
17
19
|
function validateEmailAddressOrUsername(emailAddressOrUsername) {
|
|
@@ -39,6 +41,7 @@ module.exports = {
|
|
|
39
41
|
validateAffirmation,
|
|
40
42
|
validateReleaseName,
|
|
41
43
|
validateEmailAddress,
|
|
44
|
+
validateShellCommands,
|
|
42
45
|
validateGitHubHostName,
|
|
43
46
|
validateEmailAddressOrUsername
|
|
44
47
|
};
|
package/bin/versions.js
CHANGED
|
@@ -4,12 +4,14 @@ const UNVERSIONED = "unversioned",
|
|
|
4
4
|
VERSION_1_5 = "1.5",
|
|
5
5
|
VERSION_2_0 = "2.0",
|
|
6
6
|
VERSION_5_0 = "5.0",
|
|
7
|
-
|
|
7
|
+
VERSION_5_1 = "5.1",
|
|
8
|
+
CURRENT_VERSION = VERSION_5_1; ///
|
|
8
9
|
|
|
9
10
|
module.exports = {
|
|
10
11
|
UNVERSIONED,
|
|
11
12
|
VERSION_1_5,
|
|
12
13
|
VERSION_2_0,
|
|
13
14
|
VERSION_5_0,
|
|
15
|
+
VERSION_5_1,
|
|
14
16
|
CURRENT_VERSION
|
|
15
17
|
};
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "occam-open-cli",
|
|
3
3
|
"author": "James Smith",
|
|
4
|
-
"version": "5.1.
|
|
4
|
+
"version": "5.1.1",
|
|
5
5
|
"license": "MIT, Anti-996",
|
|
6
6
|
"homepage": "https://github.com/djalbat/occam-open-cli",
|
|
7
7
|
"description": "Occam's command line package management tool.",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"argumentative": "^2.0.21",
|
|
14
|
-
"necessary": "^11.2.
|
|
14
|
+
"necessary": "^11.2.2",
|
|
15
15
|
"occam-file-system": "^5.0.134"
|
|
16
16
|
},
|
|
17
17
|
"scripts": {},
|