grunt-sync
Advanced tools
Comparing version 0.2.1 to 0.2.2
{ | ||
"name": "grunt-sync", | ||
"description": "Task to synchronize two directories. Similar to grunt-copy but updates only files that have been changed.", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"homepage": "https://github.com/tomusdrw/grunt-sync.git", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -50,3 +50,3 @@ # Grunt-sync | ||
ignoreInDest: "**/*.js", // Never remove js files from destination | ||
updateAndDelete: true // Remove all files from desc that are not found in src | ||
updateAndDelete: true // Remove all files from dest that are not found in src | ||
@@ -63,2 +63,3 @@ } | ||
## Changelog | ||
* 0.2.2 - Fixed issue with `updateAndDelete` when source patterns matches only files. | ||
* 0.2.1 - Fixed grunt Compact Format. | ||
@@ -76,2 +77,6 @@ * 0.2.0 - Default configuration will not remove any files any more. You have to specify `updateAndDelete` option to remove any files from destination. | ||
## TODO | ||
Research if it's possible to have better integration with `grunt-contrib-watch` - update only changed files instead of scanning everything. | ||
* Research if it's possible to have better integration with `grunt-contrib-watch` - update only changed files instead of scanning everything. | ||
* Some tests for common problems | ||
* Some tests to assure performance | ||
* Rewrite `updateAndDelete` in more elegant way (maybe use patterns from source?) |
@@ -17,3 +17,10 @@ { | ||
"dest": "bin/somefile2.txt" | ||
}, | ||
"windows": { | ||
"files": [ | ||
{ "src": ["www\\**\\*.*", "!**\\*.ts"], "dest": "cordova\\"}], | ||
"verbose": true, | ||
"pretend": false, | ||
"updateAndDelete": true | ||
} | ||
} | ||
} |
@@ -110,2 +110,3 @@ var fs = require('promised-io/fs'), | ||
logger.writeln('Unlinking ' + filePath.cyan + ' because it was removed from src.'); | ||
if (justPretend) { | ||
@@ -162,2 +163,15 @@ return; | ||
var addDirectoriesPaths = function(arr, dest) { | ||
var f = dest.split(path.sep); | ||
var i, p; | ||
p = f[0]; | ||
for (i=1; i<f.length - 1; ++i) { | ||
p += path.sep + f[i]; | ||
if (arr.indexOf(p) === -1) { | ||
arr.push(p); | ||
} | ||
} | ||
}; | ||
grunt.registerMultiTask('sync', 'Synchronize content of two directories.', function() { | ||
@@ -198,3 +212,8 @@ var done = this.async(), | ||
} | ||
processedDestinations.push(dest); | ||
if (!updateOnly) { | ||
processedDestinations.push(dest); | ||
// Make sure to add directory of file as well (handle cases when source has pattern for files only) | ||
addDirectoriesPaths(processedDestinations, dest); | ||
} | ||
// Process pair | ||
return processPair(justPretend, logger, path.join(cwd, src), dest); | ||
@@ -201,0 +220,0 @@ })); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16515
305
80
8