Skip to content

Commit

Permalink
Merge pull request #29 from ibm-wch/rel3.0.4
Browse files Browse the repository at this point in the history
Changes for version 3.0.4.
  • Loading branch information
Thomas Dinger authored Jul 30, 2018
2 parents 8040f7c + 55ed586 commit 064c35c
Show file tree
Hide file tree
Showing 34 changed files with 1,951 additions and 1,289 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

### 3.0 changes since 2.9

- NOTE: The 3.0 major version number upgrade of wchtools has a change in default behavior.
- The DEFAULT for pull, push, list and compare has been changed to only operate on "ready" items.
- wchtools is commonly used to package up ready applications, sample or otherwise, to be transferred to another WCH tenant (staging to production, or a business partner building an application for a client) and you would typically only want the final (non-draft) ready items to be pulled from the staging tenant and sent to production tenant(s).
- To obtain the prior (draft and ready, for content and assets) behavior, you may use the --draft and --ready command line arguments, to the push, pull, compare, and list commands.

### 2.9.2 changes since 2.8.2
- New compare command for comparing source and target exports or source export with a target tenant, optionally writing a manifest of updates needed in the target, from the source, along with an optional manifest of items deleted from source that could then be deleted from the target with wchtools delete --manifest
- New optional push --publish-now argument, to override a global publishing schedule, when you need to push and publish new web artifacts immediately, to address an issue.
Expand Down
2 changes: 2 additions & 0 deletions CLI/commands/compare.js
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,8 @@ function compareCommand (program) {
.option('-R --publishing-site-revisions',i18n.__('cli_compare_opt_site_revisions'))
.option('-v --verbose', i18n.__('cli_compare_opt_verbose'))
.option('-A --all-authoring', i18n.__('cli_compare_opt_all'))
.option('--ready', i18n.__('cli_compare_opt_ready'))
.option('--draft', i18n.__('cli_compare_opt_draft'))
.option('--manifest <manifest>', i18n.__('cli_compare_opt_use_manifest'))
.option('--filter-deletions <manifest>', i18n.__('cli_compare_opt_filter_deletions'))
.option('--write-manifest <manifest>', i18n.__('cli_compare_opt_write_manifest'))
Expand Down
2 changes: 1 addition & 1 deletion CLI/commands/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ function listCommand (program) {
.option('-A --all-authoring', i18n.__('cli_list_opt_all'))
.option('--write-manifest <manifest>', i18n.__('cli_list_opt_write_manifest'))
.option('--ready', i18n.__('cli_list_opt_ready'))
//.option('--draft', i18n.__('cli_list_opt_draft'))
.option('--draft', i18n.__('cli_list_opt_draft'))
.option('--path <path>', i18n.__('cli_list_opt_path'))
.option('--dir <dir>', i18n.__('cli_list_opt_dir'))
.option('--user <user>', i18n.__('cli_opt_user_name'))
Expand Down
2 changes: 1 addition & 1 deletion CLI/commands/pull.js
Original file line number Diff line number Diff line change
Expand Up @@ -1666,7 +1666,7 @@ function pullCommand (program) {
.option('--write-manifest <manifest>',i18n.__('cli_pull_opt_write_manifest'))
.option('--write-deletions-manifest <manifest>',i18n.__('cli_pull_opt_write_deletions_manifest'))
.option('--ready', i18n.__('cli_pull_opt_ready'))
//.option('--draft', i18n.__('cli_pull_opt_draft'))
.option('--draft', i18n.__('cli_pull_opt_draft'))
.option('--dir <dir>', i18n.__('cli_pull_opt_dir'))
.option('--user <user>', i18n.__('cli_opt_user_name'))
.option('--password <password>', i18n.__('cli_opt_password'))
Expand Down
5 changes: 2 additions & 3 deletions CLI/commands/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,12 +1071,11 @@ class PushCommand extends BaseCommand {
deferred.reject(new Error(i18n.__('cli_push_name_and_ready')));
return deferred.promise;
}
/*

if (this.getCommandLineOption("draft")) {
deferred.reject(new Error(i18n.__('cli_push_name_and_draft')));
return deferred.promise;
}
*/
}

if (this.getOptionArtifactCount() !== 1) {
Expand Down Expand Up @@ -1144,7 +1143,7 @@ function pushCommand (program) {
.option('--publish-now', i18n.__('cli_push_opt_publish_now'))
.option('--create-only', i18n.__('cli_push_opt_create_only'))
.option('--ready', i18n.__('cli_push_opt_ready'))
//.option('--draft', i18n.__('cli_push_opt_draft'))
.option('--draft', i18n.__('cli_push_opt_draft'))
.option('--named <named>', i18n.__('cli_push_opt_named'))
.option('--path <path>', i18n.__('cli_push_opt_path'))
.option('--manifest <manifest>', i18n.__('cli_push_opt_use_manifest'))
Expand Down
60 changes: 34 additions & 26 deletions CLI/lib/baseCommand.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ const log4js = require('log4js');
const ProductVersion = require("../package.json").version;
const cliLog = "cli" + " " + ProductVersion;

const DRAFT_SITES = false;

class BaseCommand {
/**
* Create a BaseCommand object.
Expand Down Expand Up @@ -63,6 +65,16 @@ class BaseCommand {
this._cleanups = [];
}

/**
* Determine whether draft sites (and pages) are supported.
*
* @returns {Boolean} A return value of true indicates that draft sites (and pages) are supported. A return value of
* false indicates that draft sites (and pages) are not supported.
*/
static get DRAFT_SITES() {
return DRAFT_SITES;
};

/**
* Get the Commander program object used by this command.
*
Expand Down Expand Up @@ -471,12 +483,6 @@ class BaseCommand {
if (this.getCommandLineOption("renditions")) {
this._optionArtifactCount++;
}
if (this.getCommandLineOption("publishingSources")) {
this._optionArtifactCount++;
}
if (this.getCommandLineOption("publishingProfiles")) {
this._optionArtifactCount++;
}
if (this.getCommandLineOption("publishingSiteRevisions")) {
this._optionArtifactCount++;
}
Expand Down Expand Up @@ -802,32 +808,36 @@ class BaseCommand {
*/
handleReadyDraftOptions () {
const deferred = Q.defer();
const readyOnly = this.getCommandLineOption("ready");
//const draftOnly = this.getCommandLineOption("draft");
const ready = this.getCommandLineOption("ready");
const draft = this.getCommandLineOption("draft");
const manifest = this.getCommandLineOption("manifest");
if (readyOnly) {
/*if (draftOnly) {
// Cannot specify both the "ready" and "draft" options.
const errorMessage = i18n.__('cli_ready_and_draft_options');
deferred.reject(new Error(errorMessage));
} else*/ if (manifest) {
if (ready) {
if (manifest) {
// Cannot specify both the "ready" and "manifest" options.
const errorMessage = i18n.__('cli_ready_and_manifest_options');
deferred.reject(new Error(errorMessage));
} else {
this.setApiOption("filterReady", true);
if (!draft) {
// Ready was specified, draft was not.
this.setApiOption("filterReady", true);
}

// Note: If both ready and draft were specified, no filtering is required.
deferred.resolve();
}
} /*else if (draftOnly) {
} else if (draft) {
if (manifest) {
// Cannot specify both the "draft" and "manifest" options.
const errorMessage = i18n.__('cli_draft_and_manifest_options');
deferred.reject(new Error(errorMessage));
} else {
// Draft was specified, ready was not.
this.setApiOption("filterDraft", true);
deferred.resolve();
}
}*/ else {
} else {
// If neither ready nor draft is specified, default to ready.
this.setApiOption("filterReady", true);
deferred.resolve();
}

Expand Down Expand Up @@ -857,11 +867,9 @@ class BaseCommand {
deferred.resolve();
} else {
// Determine what type of sites to use for this command -- draft, ready, or both.
// Note that draft sites must always be included for the delete --all command.
const includeReadySites = this.getCommandLineOption("ready") || !this.getCommandLineOption("draft");
const includeDraftSites = (this.getCommandLineOption("draft") || !this.getCommandLineOption("ready")) && this.getCommandLineOption("all");

// TODO Until the Sites API defects for push and pull of draft pages/sites are fixed, only allow the
// TODO draft site to be included for the delete --all command.
const includeDraftSites = (this.getCommandLineOption("draft") && BaseCommand.DRAFT_SITES) || this.getCommandLineOption("all");

// Get all sites, either local or remote.
const getSites = remote ? ToolsApi.getRemoteSites : ToolsApi.getLocalSites;
Expand All @@ -885,13 +893,13 @@ class BaseCommand {
});
} else {
// There are no local site artifacts, so just use the defaults.
//if (includeReadySites) {
if (includeReadySites) {
readySiteIds.push("default");
//}
}

//if (includeDraftSites) {
// draftSiteIds.push("default:draft");
//}
if (includeDraftSites) {
draftSiteIds.push("default:draft");
}

// TODO Do we need a more robust solution when additional sites can be created?
}
Expand Down
2 changes: 0 additions & 2 deletions CLI/nls/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
"cli_save_manifest_failure": "An error occurred when trying to save the manifest: %(err)s.",
"cli_invalid_url_option": "The specified API URL is not valid.",
"cli_invalid_path_option": "Invalid options, path can only be used for web assets, content types, layouts, and layout mappings.",
"cli_ready_and_draft_options" : "Invalid options, cannot specifiy both ready and draft.",
"cli_ready_and_manifest_options": "Invalid options, cannot specifiy both ready and manifest.",
"cli_draft_and_manifest_options": "Invalid options, cannot specifiy both draft and manifest.",
"cli_help_on_commands": "For help on specific commands use wchtools <command> -h",
Expand Down Expand Up @@ -336,7 +335,6 @@
"cli_rendering_job_started": "Starting render request.",
"cli_rendering_job_created": "Render request was accepted.",
"cli_rendering_opt_rebuild": "Delete content items from delivery and republish them. This implicitly triggers a re-rendering of all your content. A rebuild ignores global publish schedules and the auto publish flag.",

"cli_publishing_description": "Publish all ready artifacts that have not automatically been published.",
"cli_publishing_opt_rebuild": "Delete all artifacts from delivery and republish them. A rebuild ignores global publish schedules and the auto publish flag.",
"cli_publishing_opt_status": "Display the current state of the publishing site revision. Use of an optional id has been deprecated, and will be ignored if specified.",
Expand Down
2 changes: 1 addition & 1 deletion CLI/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "wchtools-cli",
"description": "Command line tools for IBM Watson Content Hub",
"version": "2.9.2",
"version": "3.0.4",
"keywords": [
"cli"
],
Expand Down
Loading

0 comments on commit 064c35c

Please sign in to comment.