Closed ts-web closed 9 years ago
bump
It appears that this task only additively copies changed files to the destination; it does not delete files in the destination.
Also, it looks at the destination; if the file is missing, it copies it there.
I am not sure whether it compares the file contents of the destination file and the source file. Does anyone know? Or does it rely on file modification time?
In the source code I see it compares file modification time via fs.stat(file).mtime.getTime()
.
I am willing to submit a PR to explain this in the Readme, but I would like someone to first confirm that it works this way:
grunt-sync synchronizes source files to a destination location. It compares the source and destination file modification times, and copies only newer source files. If the files do not exist in the destination, it creates them.
Hi! Sorry for such late answer. I've updated readme files with description of how the plugin works.
Could you have a look at it and tell me if this makes sense to you.
I would clarify a few things:
Second phase deletes files that exists in dest but have not been found in src.
This only happens if updateAndDelete
is set to true, and the default is false.
Also #4 of the steps list has this issue too.
[2nd phase] Read all files in dest and calculate difference between files in destination and source files.
This sounds like it's reading the contents of the files. I would say: "Get a list of the files in dest and calculate the difference between dest and source."
Other than that it makes sense. Thanks.
In the readme, it only says, "[grunt-sync] tries to copy only those files that has actually changed."
Does it look at the timestamps of the source files and compare each with the timestamp when grunt-sync last ran? Or does it look at the timestamp of each destination file?
Also, what kind of synchronization does it do? Does it only add new files? Or does it compare directory contents to ensure a mirror copy (removing files in dest that aren't in src)?
Please explain what exactly it does, and update the readme.