cob-cli 2.55.0-beta-1 → 2.55.0-beta-3

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.
@@ -47,10 +47,14 @@ async function _syncFiles(executionType, cmdEnv, from, to, extraOptions = [], ar
47
47
  while (count < RSYNC_RETRIES) {
48
48
  if (args.verbose > 2)
49
49
  console.log("rsync".bold +" '" + (product).blue + "': attempt " + (count + 1));
50
- const protectFilters = _getDecryptedEncFilePaths(product).map(p => `--filter='P ${p}'`);
50
+ // Exclude the decrypted siblings of every local .enc file: their content on the
51
+ // server is owned by cob-decrypt, never by a local cleartext file with the same
52
+ // path.
53
+ const excludeDecryptedFilters = _getDecryptedEncFilePaths(product).map(p => `--filter='- ${p}'`);
51
54
  const rsyncArgs = [
52
55
  fromPath,
53
56
  toPath,
57
+ ...excludeDecryptedFilters,
54
58
  "-acvi",
55
59
  "--delete",
56
60
  "--chmod=g+w",
@@ -60,7 +64,6 @@ async function _syncFiles(executionType, cmdEnv, from, to, extraOptions = [], ar
60
64
  "--filter='merge " + path.resolve(__dirname,"rsyncFilter-pre.txt") + "'",
61
65
  hasRsyncFilter ? "--filter='merge " + cmdEnv.rsyncFilter + "'" : "",
62
66
  "--filter='merge " + path.resolve(__dirname,"rsyncFilter-post.txt") + "'",
63
- ...protectFilters,
64
67
  executionType == _syncFiles.COPY ? "-v" : "--dry-run"
65
68
  ].concat(productExtraOptions)
66
69
  if (args.verbose > 3) {
@@ -126,6 +126,16 @@ async function restoreServerFilesToLastDeployed(cmdEnv, changedFiles) {
126
126
 
127
127
  for (const changedFile of changedFiles) {
128
128
  await removeFileFromCurrentTest(cmdEnv.server, changedFile);
129
+ // A .enc file is decrypted onto its sibling path on the server. When the .enc did not
130
+ // exist at the last deploy (it's new to this test), that decrypted output either
131
+ // overwrote a previously deployed cleartext file (e.g. a file being "encrypted":
132
+ // cleartext removed, .enc added) or is brand new. The diff that seeds the test only
133
+ // tracks the .enc, never the overwritten/removed sibling, so roll the sibling back to
134
+ // the last deployed state explicitly: restores the cleartext if there was one, or
135
+ // removes the stray decrypted file if there wasn't.
136
+ if (changedFile.endsWith(".enc") && !fs.existsSync(changedFile)) {
137
+ await removeFileFromCurrentTest(cmdEnv.server, changedFile.slice(0, -4));
138
+ }
129
139
  }
130
140
 
131
141
  await cmdEnv.unApplyLastEnvironmentDeployedToServerChanges();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cob-cli",
3
- "version": "2.55.0-beta-1",
3
+ "version": "2.55.0-beta-3",
4
4
  "description": "A command line utility to help Cult of Bits partners develop with higher speed and reusing common code and best practices.",
5
5
  "preferGlobal": true,
6
6
  "repository": {