in gulpfile.js [147:182]
function copyDocsVersion (oldVersion, newVersion, cb) {
// copying a folder and a ToC file for each language
const numCopyOperations = LANGUAGES.length * 2;
// pseudo-CV (condition variable)
let numCopied = 0;
function doneCopying (error) {
if (error) {
cb(error);
return;
}
// call callback if all folders have finished copying
numCopied += 1;
if (numCopied === numCopyOperations) {
cb();
}
}
// create a new version for each language
LANGUAGES.forEach(function (languageName) {
// get files to copy
const oldVersionDocs = path.join(DOCS_DIR, languageName, oldVersion);
const oldVersionToc = path.join(TOC_DIR, srcTocfileName(languageName, oldVersion));
const newVersionDocs = path.join(DOCS_DIR, languageName, newVersion);
const newVersionToc = path.join(TOC_DIR, srcTocfileName(languageName, newVersion));
// copy docs
console.log(oldVersionDocs + ' -> ' + newVersionDocs);
fs.cp(oldVersionDocs, newVersionDocs, { recursive: true, force: true }, doneCopying);
// copy ToC
console.log(oldVersionToc + ' -> ' + newVersionToc);
fs.cp(oldVersionToc, newVersionToc, { recursive: true, force: true }, doneCopying);
});
}