andrewrjones/grunt-ssh — pull request #5 by marcins (2013-02-27 21:43:22+00:00)
Title: SFTP dest directories aren't created if they don't already exist

The current task fails if you're sftp'ing a whole tree and the target directories don't already exist.

I've started work on trying to add this feature, I've written a piece of code that does a recursive opendir/mkdir to ensure all the paths exist, however I've run into some issues due to the main file transfer taking part asynchronously.

I'm working on an approach where I first create an array of unique paths and then verify their existence before starting the file transfers, but this is currently a work in progress.

Would love to hear your thoughts or ideas, otherwise I'll crack on with getting a PR together.

Also the body of the task could probably do with being broken into smaller functions, as I'm starting to run into a bit of callback hell, this would also help with nodeunit testing. Might do a little of this to make the code for the directory creation a bit more easy to follow.