rsyncwrapper
Advanced tools
Comparing version 0.4.2 to 0.4.3
@@ -71,2 +71,8 @@ "use strict"; | ||
if ( typeof options.excludeFirst !== "undefined" && util.isArray(options.excludeFirst) ) { | ||
options.excludeFirst.forEach(function (value,index) { | ||
args.push("--exclude="+value); | ||
}); | ||
} | ||
if ( typeof options.include !== "undefined" && util.isArray(options.include) ) { | ||
@@ -73,0 +79,0 @@ options.include.forEach(function (value,index) { |
{ | ||
"name": "rsyncwrapper", | ||
"version": "0.4.2", | ||
"version": "0.4.3", | ||
"description": "An async wrapper to the rsync command line utility for Node.js.", | ||
@@ -5,0 +5,0 @@ "main": "lib/rsyncwrapper", |
@@ -7,2 +7,3 @@ ## rsyncwrapper | ||
- `0.4.3` Added the `excludeFirst` option. See [#34](https://github.com/jedrichards/rsyncwrapper/issues/34). | ||
- `0.4.2` Add default `chmod` arguments on Windows to fix NTFS permissions, see [#28](https://github.com/jedrichards/rsyncwrapper/issues/28). | ||
@@ -91,2 +92,6 @@ - `0.4.1` Renamed `syncDest` and `syncDestIgnoreExcl` options to the more scary sounding `deleteAll` and `delete` options in an effort to avoid potential user data loss due to misconfiguration. Updated docs to use the new option names. The old option names will continue to work. | ||
##### `include [Array<String>]` | ||
Optional array of rsync patterns to include in the transfer, if previously excluded. Include patterns are defined before exclude patterns when building the rsync command. | ||
##### `exclude [Array<String>]` | ||
@@ -96,5 +101,5 @@ | ||
##### `include [Array<String>]` | ||
##### `excludeFirst [Array<String>]` | ||
Optional array of rsync patterns to include in the transfer, if previously excluded. Include patterns are defined before exclude patterns when building the rsync command. | ||
Optional array of rsync patterns to exclude from transfer. These are defined *before* the include patterns when building the rsync command. This is useful to exclude specific files or folders that would be included by the include patterns. | ||
@@ -101,0 +106,0 @@ ##### `dryRun [Boolean] default: false` |
@@ -15,2 +15,4 @@ "use strict"; | ||
var destDirArray = "./tmp/multiple-array"; | ||
var destDirInclude = "./tmp/multiple-include"; | ||
var destDirPreExclude = "./tmp/multiple-preexclude"; | ||
@@ -173,2 +175,65 @@ exports.suite = vows.describe("Multi file copy tests").addBatch({ | ||
} | ||
}).addBatch({ | ||
"Copying multiple files to a new dir with include": { | ||
topic: function() { | ||
var src = "./tests/fixtures/"; | ||
rsync({ | ||
src: src, | ||
recursive: true, | ||
dest: destDirInclude, | ||
include: ["multiple/***"], | ||
exclude: ["*"] | ||
},this.callback); | ||
}, | ||
"outputs the used shell command": function (error,stdout,stderr,cmd) { | ||
assert.isNotNull(cmd); | ||
}, | ||
"does not error": function (error,stdout,stderr) { | ||
assert.isNull(error); | ||
}, | ||
"produces stdout": function (error,stdout,stderr) { | ||
assert.isNotNull(stdout); | ||
}, | ||
"results in a dir that": { | ||
topic: function () { | ||
fs.readdir(destDirInclude + "/multiple",this.callback); | ||
}, | ||
"has contents": function (error,files) { | ||
assert.isNull(error); | ||
assert.equal(files.length,3); | ||
} | ||
} | ||
} | ||
}).addBatch({ | ||
"Copying multiple files to a new dir with pre-exclude": { | ||
topic: function() { | ||
var src = "./tests/fixtures/"; | ||
rsync({ | ||
src: src, | ||
recursive: true, | ||
dest: destDirPreExclude, | ||
excludeFirst: ["multiple2.txt"], | ||
include: ["multiple/***"], | ||
exclude: ["*"] | ||
},this.callback); | ||
}, | ||
"outputs the used shell command": function (error,stdout,stderr,cmd) { | ||
assert.isNotNull(cmd); | ||
}, | ||
"does not error": function (error,stdout,stderr) { | ||
assert.isNull(error); | ||
}, | ||
"produces stdout": function (error,stdout,stderr) { | ||
assert.isNotNull(stdout); | ||
}, | ||
"results in a dir that": { | ||
topic: function () { | ||
fs.readdir(destDirPreExclude + "/multiple",this.callback); | ||
}, | ||
"has one less file": function (error,files) { | ||
assert.isNull(error); | ||
assert.equal(files.length,2); | ||
} | ||
} | ||
} | ||
}); |
31682
621
187