From bf09de8b9ab38201564cc9be7acdd7050290b5d2 Mon Sep 17 00:00:00 2001 From: Michal Kochel Date: Tue, 5 Apr 2016 12:00:47 +0200 Subject: [PATCH] Fixed file deletion. Readme updated. --- README.md | 8 ++++---- package.json | 2 +- src/handlers/content-handler.js | 1 - src/watcher.js | 4 ++++ 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c25a8f7..d708307 100644 --- a/README.md +++ b/README.md @@ -40,12 +40,12 @@ JavaScript ```JavaScript const aemsync = require('aemsync') -let workingDir = "~/workspace/my_project" +let workingDir = '~/workspace/my_project' let targets = [ - "http://admin:admin@localhost:4502", - "http://admin:admin@localhost:4503" + 'http://admin:admin@localhost:4502', + 'http://admin:admin@localhost:4503' ] -let exclude = "**/*.orig" // Skip merge files. +let exclude = '**/*.orig' // Skip merge files. let pushInterval = 300 new aemsync.Watcher(workingDir, exclude, () => { diff --git a/package.json b/package.json index 1b7c43e..9a466c5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "aemsync", - "version": "1.0.0-rc.0", + "version": "1.0.1", "description": "Adobe AEM Synchronization Tool", "author": "Michal Kochel ", "keywords": [ diff --git a/src/handlers/content-handler.js b/src/handlers/content-handler.js index 1214675..32d50ad 100644 --- a/src/handlers/content-handler.js +++ b/src/handlers/content-handler.js @@ -12,7 +12,6 @@ const RE_TARGET_PATH = /^.*\/target\/(.*\/)?jcr_root\/.*$/ class ContentHandler { process (items, localPath) { let cleanPath = localPath.replace(/\\/g, '/') - // TODO: Simplify path checking. // Ignore dot-prefixed files and directories except ".content.xml". diff --git a/src/watcher.js b/src/watcher.js index 1351936..baa33c4 100644 --- a/src/watcher.js +++ b/src/watcher.js @@ -34,6 +34,10 @@ class Watcher { fs.stat(localPath, (err, stats) => { if (err) { + // If file does not exist - process deletion. + if (err.code === 'ENOENT') { + callback(localPath) + } return }