Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
drothery-edb committed Mar 11, 2022
2 parents 376b588 + 284dc4a commit 0ee17ed
Show file tree
Hide file tree
Showing 5 changed files with 43 additions and 30 deletions.
23 changes: 14 additions & 9 deletions scripts/source/bdr.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const destination = path.resolve(args[1]);
file.path = destFilepath;
try {
await fs.mkdir(path.dirname(file.path));
} catch {}
} catch { }
await write(file);
};

Expand All @@ -76,7 +76,7 @@ const destination = path.resolve(args[1]);
const fileAbsolutePath = path.resolve(basePath, dirEntry[navTitle]);
const filename = path.relative(basePath, fileAbsolutePath);
const destFilepath = path.resolve(
destPath,
basePath,
filename.replace(/\//g, "_") + "x",
);

Expand All @@ -90,7 +90,7 @@ const destination = path.resolve(args[1]);
);

if (filename === indexFilename) continue;
process(fileAbsolutePath, filename, destFilepath);
await process(fileAbsolutePath, filename, destFilepath);
}
}

Expand All @@ -102,14 +102,19 @@ const destination = path.resolve(args[1]);
description:
"BDR (Bi-Directional Replication) is a ground-breaking multi-master replication capability for PostgreSQL clusters that has been in full production status since 2014.",
};
process(
await process(
path.resolve(basePath, indexFilename),
indexFilename,
path.resolve(destPath, indexFilename + "x"),
path.resolve(basePath, indexFilename + "x"),
);

// copy images
exec(`rsync -a --delete ${imgPath} ${destPath}`);
await exec(`rsync -am --delete --include="*/" --include="*.png" --include="*.jpg" --include="*.jpeg" --include="*.svg" --exclude="*" ${imgPath} ${destPath}`);

// copy select files, removing those that have been deleted
await exec(`rsync --archive --recursive --delete --include="*/" --include="*.mdx" --exclude="*" ${basePath}/ ${destPath}/`);
// uncomment this if BDR ever includes images in the normal place
//await exec(`rsync --archive --recursive --delete --include="*/" --include="*.mdx" --include="*/" --include="*.png" --include="*.jpg" --include="*.jpeg" --include="*.svg" --exclude="*" ${basePath}/ ${destPath}/`);
})();

// GPP leaves the files littered with these; they alter parsing by flipping sections to HTML context
Expand Down Expand Up @@ -186,7 +191,7 @@ function bdrTransformer() {
if (node.value.trim())
console.warn(
`${file.path}:${node.position.start.line}:${node.position.start.column} Stripping HTML content:\n\t ` +
node.value,
node.value,
);

parent.children.splice(index, 1);
Expand Down Expand Up @@ -215,8 +220,8 @@ function bdrTransformer() {
const blockTypes = ["root", "paragraph", "listItem", "blockquote"];
for (
let i = ancestors.length - 1,
parent = ancestors[ancestors.length - 1],
child = node;
parent = ancestors[ancestors.length - 1],
child = node;
i >= 0;
--i, child = parent, parent = ancestors[i]
) {
Expand Down
2 changes: 1 addition & 1 deletion scripts/source/dispatch_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"EnterpriseDB/LiveCompare": f"node {args.workspace}/destination/scripts/source/livecompare.js {args.workspace}/source {args.workspace}/destination --unhandled-rejections=strict",
"EnterpriseDB/bdr": f"node {args.workspace}/destination/scripts/source/bdr.js {args.workspace}/source {args.workspace}/destination --unhandled-rejections=strict",
"EnterpriseDB/pglogical": f"node {args.workspace}/destination/scripts/source/pglogical.js {args.workspace}/source {args.workspace}/destination --unhandled-rejections=strict",
"EnterpriseDB/harp": f"rsync -a --delete {args.workspace}/source/docs/user_guide/* {args.workspace}/destination/product_docs/docs/harp/2.0",
"EnterpriseDB/harp": f"rsync -a --delete {args.workspace}/source/docs/user_guide/ {args.workspace}/destination/product_docs/docs/harp/2.0/",
}

ret = os.system(
Expand Down
20 changes: 12 additions & 8 deletions scripts/source/livecompare.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const yaml = require("js-yaml");
const visit = require("unist-util-visit");
const visitAncestors = require("unist-util-visit-parents");
const mdast2string = require("mdast-util-to-string");
const { exec } = require("child_process");
const isAbsoluteUrl = require("is-absolute-url");

const fileToMetadata = {};
Expand All @@ -38,7 +39,7 @@ const destination = path.resolve(args[1]);
file.path = destFilepath;
try {
await fs.mkdir(path.dirname(file.path), { recursive: true });
} catch {}
} catch { }
await write(file);
};

Expand All @@ -65,7 +66,7 @@ const destination = path.resolve(args[1]);
const fileAbsolutePath = path.resolve(basePath, dirEntry[navTitle]);
const filename = path.relative(basePath, fileAbsolutePath);
const destFilepath = path.resolve(
destPath,
basePath,
filename.replace(/\//g, "_") + "x",
);

Expand All @@ -79,16 +80,19 @@ const destination = path.resolve(args[1]);
);

if (filename === indexFilename) continue;
process(fileAbsolutePath, filename, destFilepath);
await process(fileAbsolutePath, filename, destFilepath);
}
}

// write out index w/ navigation tree
process(
await process(
path.resolve(basePath, indexFilename),
indexFilename,
path.resolve(destPath, indexFilename + "x"),
path.resolve(basePath, indexFilename + "x"),
);

// copy select files, removing those that have been deleted
await exec(`rsync --archive --recursive --delete --include="*/" --include="*.mdx" --include="*.png" --include="*.jpg" --include="*.jpeg" --include="*.svg" --exclude="*" ${basePath}/ ${destPath}/`);
})();

// GPP leaves the files littered with these; they alter parsing by flipping sections to HTML context
Expand Down Expand Up @@ -153,7 +157,7 @@ function livecompareTransformer() {
if (node.value.trim())
console.warn(
`${file.path}:${node.position.start.line}:${node.position.start.column} Stripping HTML content:\n\t ` +
node.value,
node.value,
);

parent.children.splice(index, 1);
Expand Down Expand Up @@ -182,8 +186,8 @@ function livecompareTransformer() {
const blockTypes = ["root", "paragraph", "listItem", "blockquote"];
for (
let i = ancestors.length - 1,
parent = ancestors[ancestors.length - 1],
child = node;
parent = ancestors[ancestors.length - 1],
child = node;
i >= 0;
--i, child = parent, parent = ancestors[i]
) {
Expand Down
19 changes: 12 additions & 7 deletions scripts/source/pglogical.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,13 @@ const yaml = require("js-yaml");
const visit = require("unist-util-visit");
const visitAncestors = require("unist-util-visit-parents");
const mdast2string = require("mdast-util-to-string");
const { exec } = require("child_process");
const isAbsoluteUrl = require("is-absolute-url");

const fileToMetadata = {};
const args = process.argv.slice(2);
const basePath = path.resolve(args[0], "docs/");
const destination = path.resolve(args[1]);

(async () => {
const processor = unified()
Expand Down Expand Up @@ -101,7 +103,7 @@ const basePath = path.resolve(args[0], "docs/");
file.path = destFilepath;
try {
await fs.mkdir(path.dirname(file.path), { recursive: true });
} catch {}
} catch { }
await write(file);
};

Expand All @@ -111,22 +113,25 @@ const basePath = path.resolve(args[0], "docs/");

const markdownToProcess = mdIndex.nav;
const version = mdIndex.site_name.match(/pglogical (\d+\.\d+)/)[1];
const destPath = path.resolve("product_docs", "docs", "pglogical", version);
const destPath = path.resolve(destination, "product_docs", "docs", "pglogical", version);
const indexFilename = "index.md";

fileToMetadata[indexFilename] = {};

for (const dirEntry of markdownToProcess) {
if (!dirEntry) continue;
await processEntry(dirEntry, destPath, indexFilename);
await processEntry(dirEntry, basePath, indexFilename);
}

// write out index w/ navigation tree
await process(
path.resolve(basePath, indexFilename),
indexFilename,
path.resolve(destPath, "index.mdx"),
path.resolve(basePath, "index.mdx"),
);

// copy select files, removing those that have been deleted
await exec(`rsync --archive --recursive --delete --include="*/" --include="*.mdx" --include="*.png" --include="*.jpg" --include="*.jpeg" --include="*.svg" --exclude="*" ${basePath}/ ${destPath}/`);
})();

// GPP leaves the files littered with these; they alter parsing by flipping sections to HTML context
Expand Down Expand Up @@ -191,7 +196,7 @@ function pglogicalTransformer() {
if (node.value.trim())
console.warn(
`${file.path}:${node.position.start.line}:${node.position.start.column} Stripping HTML content:\n\t ` +
node.value,
node.value,
);

parent.children.splice(index, 1);
Expand Down Expand Up @@ -220,8 +225,8 @@ function pglogicalTransformer() {
const blockTypes = ["root", "paragraph", "listItem", "blockquote"];
for (
let i = ancestors.length - 1,
parent = ancestors[ancestors.length - 1],
child = node;
parent = ancestors[ancestors.length - 1],
child = node;
i >= 0;
--i, child = parent, parent = ancestors[i]
) {
Expand Down
9 changes: 4 additions & 5 deletions scripts/source/test/sync-bdr.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"client_payload": {
"repo": "EnterpriseDB/bdr",
"ref": "2461cd8dbad961935e7cf91e81903d42a1997e5f",
"sha": "2461cd8dbad961935e7cf91e81903d42a1997e5f"

"repo": "EnterpriseDB/bdr",
"ref": "45b2304e8e67e88a2020b6c8a087a3d62d36f47d",
"sha": "45b2304e8e67e88a2020b6c8a087a3d62d36f47d"
}
}
}

0 comments on commit 0ee17ed

Please sign in to comment.