Skip to content

Commit 10709e3

Browse files
author
Kevin Tapperson
authored
Merge pull request #56 from acoustic-content-samples/rel4.4.0
update source for release 4.4.0
2 parents 6aa22a5 + 4055756 commit 10709e3

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+984
-265
lines changed

CHANGELOG.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,19 @@
11
# Changelog
22

3+
### 4.4.0 changes since 4.3.8
4+
- Don't pull system artifacts or /acoustic web assets unless --system is specified
5+
- Add --set-library-id <id> option to push command.
6+
- Add --publish-next option to publish command.
7+
- Add warning and prompt to publish command when using --rebuild option.
8+
- Reduce time between relogin to 12 minutes due to new shorter JWT expiration
9+
310
### 4.3.8 changes since 4.2.26
411
- Rebrand message strings from Watson Content Hub to Acoustic Content
5-
- update to acoustic sdk
6-
- fix warning about new Buffer security issue
7-
- always keep timestamps in ISO format
8-
- fix context init opts to not overwrite values loaded from .wchtoolsoptions with defaults
9-
- fix conflict handling for draft items
12+
- Update to acoustic sdk
13+
- Fix warning about new Buffer security issue
14+
- Always keep timestamps in ISO format
15+
- Fix context init opts to not overwrite values loaded from .wchtoolsoptions with defaults
16+
- Fix conflict handling for draft items
1017

1118
### 4.2.26 changes since 4.2.24
1219
- Fix dependencies.

CLI/commands/publish.js

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,21 @@ limitations under the License.
1616
"use strict";
1717

1818
const BaseCommand = require("../lib/baseCommand");
19+
const prompt = require('prompt')
20+
const Q = require("q");
1921

2022
const ToolsApi = require("wchtools-api");
2123
const utils = ToolsApi.getUtils();
2224
const i18n = utils.getI18N(__dirname, ".json", "en");
2325

26+
var property = {
27+
name: 'yesno',
28+
message: 'y/n',
29+
validator: /y[es]*|n[o]?/,
30+
warning: 'Must respond y or n',
31+
default: 'n'
32+
};
33+
2434
class PublishCommand extends BaseCommand {
2535
/**
2636
* Create a PublishCommand object.
@@ -51,6 +61,32 @@ class PublishCommand extends BaseCommand {
5161
});
5262
}
5363

64+
createPublishingJob(helper, status, context, apiOptions, jobParameters, self) {
65+
if (status) {
66+
self.displaySiteRevisionStatus(helper, context, apiOptions);
67+
} else {
68+
BaseCommand.displayToConsole(i18n.__('cli_publishing_job_starting'));
69+
70+
self.spinner = self.getProgram().getSpinner();
71+
self.spinner.start();
72+
helper.createPublishingJob(context, jobParameters, apiOptions)
73+
.then(job => {
74+
self.spinner.stop();
75+
const startedMsg = i18n.__('cli_publishing_job_started');
76+
self.successMessage(startedMsg);
77+
if (self.getCommandLineOption("verbose")) {
78+
const logger = this.getLogger();
79+
logger.info(i18n.__("cli_publishing_job_details", {job_details: JSON.stringify(job, null, " ")}));
80+
}
81+
})
82+
.catch(err => {
83+
const curError = i18n.__("cli_publishing_job_error", {message: err.message});
84+
self.spinner.stop();
85+
self.errorMessage(curError);
86+
});
87+
}
88+
}
89+
5490
/**
5591
* Create a new publishing job, or look up the status of the publishing site revision.
5692
*/
@@ -59,7 +95,6 @@ class PublishCommand extends BaseCommand {
5995
const toolsApi = new ToolsApi();
6096
const context = toolsApi.getContext();
6197

62-
const logger = this.getLogger();
6398
const mode = this.getCommandLineOption("rebuild") ? "REBUILD" : "UPDATE";
6499
const status = this.getCommandLineOption("status");
65100
const apiOptions = this.getApiOptions();
@@ -82,26 +117,23 @@ class PublishCommand extends BaseCommand {
82117
return self.handleInitialization(context);
83118
})
84119
.then(function (/*results*/) {
85-
if (status) {
86-
self.displaySiteRevisionStatus(helper, context, apiOptions);
120+
if (mode === 'REBUILD') {
121+
self.warningMessage(i18n.__('cli_publishing_rebuild_warn'));
122+
prompt.message = ''; // remove 'prompt' when asking for value
123+
prompt.start();
124+
prompt.get(property, function (err, result) {
125+
// Display a blank line to separate the prompt output from the delete output.
126+
BaseCommand.displayToConsole("");
127+
if (err) {
128+
self.errorMessage(err);
129+
} else if (result.yesno === 'yes' || result.yesno === 'y') {
130+
self.createPublishingJob(helper, status, context, apiOptions, jobParameters, self);
131+
} else {
132+
self.successMessage(i18n.__('cli_publishing_rebuild_canceled'));
133+
}
134+
});
87135
} else {
88-
BaseCommand.displayToConsole(i18n.__('cli_publishing_job_starting'));
89-
self.spinner = self.getProgram().getSpinner();
90-
self.spinner.start();
91-
return helper.createPublishingJob(context, jobParameters, apiOptions)
92-
.then(job => {
93-
self.spinner.stop();
94-
const startedMsg = i18n.__('cli_publishing_job_started');
95-
self.successMessage(startedMsg);
96-
if (self.getCommandLineOption("verbose")) {
97-
logger.info(i18n.__("cli_publishing_job_details", {job_details: JSON.stringify(job, null, " ")}));
98-
}
99-
})
100-
.catch(err => {
101-
const curError = i18n.__("cli_publishing_job_error", {message: err.message});
102-
self.spinner.stop();
103-
self.errorMessage(curError);
104-
});
136+
self.createPublishingJob(helper, status, context, apiOptions, jobParameters, self)
105137
}
106138
})
107139
.catch(err => {
@@ -110,7 +142,7 @@ class PublishCommand extends BaseCommand {
110142
.finally(() =>{
111143
self.resetCommandLineOptions();
112144
});
113-
}
145+
};
114146

115147
/**
116148
* Reset the command line options for this command.

CLI/commands/pull.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ class PullCommand extends BaseCommand {
112112
// Make sure the "dir" option can be handled successfully.
113113
let error;
114114
self.handleDirOption(context)
115+
.then(function () {
116+
// Handle the system option.
117+
return self.handleSystemOption();
118+
})
115119
.then(function () {
116120
// Make sure the url has been specified.
117121
return self.handleUrlOption(context);
@@ -1849,6 +1853,7 @@ class PullCommand extends BaseCommand {
18491853
this.setCommandLineOption("serverManifest", undefined);
18501854
this.setCommandLineOption("writeManifest", undefined);
18511855
this.setCommandLineOption("writeDeletionsManifest", undefined);
1856+
this.setCommandLineOption("system", undefined);
18521857
super.resetCommandLineOptions();
18531858
}
18541859
}
@@ -1876,6 +1881,7 @@ function pullCommand (program) {
18761881
.option('-I --ignore-timestamps',i18n.__('cli_pull_opt_ignore_timestamps'))
18771882
.option('--by-type-name <name>', i18n.__('cli_pull_opt_by_type_name'))
18781883
.option('--deletions', i18n.__('cli_pull_opt_deletions'))
1884+
.option('--system', i18n.__('cli_pull_opt_system'))
18791885
.option('-q --quiet', i18n.__('cli_pull_opt_quiet'))
18801886
.option('--site-context <contextRoot>', i18n.__('cli_pull_opt_siteContext'))
18811887
.option('--path <path>', i18n.__('cli_pull_opt_path'))

CLI/commands/push.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,10 +313,17 @@ class PushCommand extends BaseCommand {
313313
if (self.getCommandLineOption("publishNow")) {
314314
self.setApiOption("publish-now", true);
315315
}
316+
if (self.getCommandLineOption("publishNext")) {
317+
self.setApiOption("publish-next", true);
318+
}
316319
const setTagVal = self.getCommandLineOption("setTag");
317320
if (setTagVal) {
318321
self.setApiOption("setTag", setTagVal);
319322
}
323+
const setLibraryVal = self.getCommandLineOption("setLibraryId");
324+
if (setLibraryVal) {
325+
self.setApiOption("setLibrary", setLibraryVal);
326+
}
320327
if (self.getCommandLineOption("keepUsers")) {
321328
self.setApiOption("keepUsers", true);
322329
}
@@ -1406,7 +1413,9 @@ class PushCommand extends BaseCommand {
14061413
this.setCommandLineOption("serverManifest", undefined);
14071414
this.setCommandLineOption("writeManifest", undefined);
14081415
this.setCommandLineOption("publishNow", undefined);
1416+
this.setCommandLineOption("publishNext", undefined);
14091417
this.setCommandLineOption("setTag", undefined);
1418+
this.setCommandLineOption("setLibrary", undefined);
14101419
this.setCommandLineOption("keepUsers", undefined);
14111420
super.resetCommandLineOptions();
14121421
}
@@ -1435,6 +1444,7 @@ function pushCommand (program) {
14351444
.option('-A --all-authoring', i18n.__('cli_push_opt_all'))
14361445
.option('-f --force-override', i18n.__('cli_push_opt_force_override'))
14371446
.option('--publish-now', i18n.__('cli_push_opt_publish_now'))
1447+
.option('--publish-next', i18n.__('cli_push_opt_publish_next'))
14381448
.option('--create-only', i18n.__('cli_push_opt_create_only'))
14391449
.option('--ready', i18n.__('cli_push_opt_ready'))
14401450
.option('--draft', i18n.__('cli_push_opt_draft'))
@@ -1446,6 +1456,7 @@ function pushCommand (program) {
14461456
.option('--write-manifest <manifest>', i18n.__('cli_push_opt_write_manifest'))
14471457
.option('--dir <dir>', i18n.__('cli_push_opt_dir'))
14481458
.option('--set-tag <tag>', i18n.__('cli_push_opt_set_tag'))
1459+
.option('--set-library-id <library-id>', i18n.__('cli_push_opt_set_tag'))
14491460
.option('--keep-users', i18n.__('cli_push_opt_keep_users'))
14501461
.option('--user <user>', i18n.__('cli_opt_user_name'))
14511462
.option('--password <password>', i18n.__('cli_opt_password'))

CLI/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ const checkUpdateNotifier = function() {
100100
current_version: pkg.version,
101101
new_version: notifier.update.latest});
102102
const changelogmsg = i18n.__('cli_update_notifier_changelog',
103-
{changelog_url: "https://github.com/ibm-wch/wchtools-cli/blob/master/CHANGELOG.md" });
103+
{changelog_url: "https://github.com/acoustic-content-samples/wchtools-cli/blob/master/CHANGELOG.md" });
104104
notifier.notify({message: changelogmsg + '\n' + upmsg });
105105
}
106106
}

CLI/lib/baseCommand.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -698,6 +698,20 @@ class BaseCommand {
698698
return defer.promise;
699699
}
700700

701+
/**
702+
* Handle the system option.
703+
*
704+
* @returns {Q.Promise} A promise that is resolved if the system option is properly handled, and rejected to
705+
* indicate that command execution should not continue.
706+
*/
707+
handleSystemOption () {
708+
if (this.getCommandLineOption("system")) {
709+
this.setApiOption("allowSystemArtifacts", true);
710+
}
711+
712+
return Q();
713+
}
714+
701715
/**
702716
* Handle the authentication options. These can be specified as command line options, user property (username), or
703717
* environment variable (password). If either value is missing, the user will be prompted for the missing value(s).

0 commit comments

Comments
 (0)