return __awaiter(this, void 0, void 0, function* () { let listFileName = this.tmp + `/rsync-${dir}`; let list = this.flatten(results.new.map(x => { let fn = `${dir}/${transformer(x)}`; return [fn, fn + '.zsync']; })); yield this.mkdir(path.resolve(this.destination, dir)); yield fs.writeFileAsync(listFileName, list.join(os.EOL)); let options = [`--files-from=${listFileName}`]; yield this.runRsyncOrDry(this.source + '/', this.destination, options); for (var x of list.map(x => path.resolve(this.destination, x))) { if (!(yield fs.existsAsync(x))) throw new Error("File not found: " + x); } ; list = this.flatten(results.obsolete.map(x => { let fn = `${this.destination}/${dir}/${transformer(x)}`; return [fn, fn + '.zsync']; })); if (this.options.dry) console.log(list.map(x => `rm ${x}`).join(os.EOL)); else { for (var i in list) { let f = list[i]; if (yield !fs.existsAsync(f)) continue; yield fs.removeAsync(f); } } });
return __awaiter(this, void 0, void 0, function* () { if (!(yield fs.existsAsync(filePath))) return false; if (!(yield fs.existsAsync(filePath + ".zsync"))) return false; return true; });
return __awaiter(this, void 0, void 0, function* () { let fn = "/packages.json"; let srcFile = this.tmp + fn; yield this.runRsync(this.source + fn, srcFile); let dstFile = this.destination + fn; let results = yield this.comparePackages(require(srcFile), ((yield fs.existsAsync(dstFile)) ? require(dstFile) : { packages: {} })); yield this.processPackagesChanges(results); });
return __awaiter(this, void 0, void 0, function* () { if (!(yield fs.existsAsync(dir))) yield fs.mkdirAsync(dir); });