Skip to content

Commit

Permalink
Attempt to fix recursive mkdir in simple mode (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
inossidabile committed Nov 10, 2013
1 parent 3295761 commit 257310b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions tasks/ftpush.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,7 @@ module.exports = (grunt) ->
files = @findLocallyModified()

upload = (path, done) =>
grunt.log.debug "Make directory", util.inspect(path)

@ftp.raw.mkd @normalizeFtpPath(Path.join(@remoteRoot, path)), (err) =>
if err
grunt.log.debug "Remote folder wasn't creted (isn't empty?) " + path + " --> " + err
else
grunt.log.ok "New remote folder created " + path.yellow

@touchRecursive Path.join(@remoteRoot, path), =>
files[path].each (file) =>
commands.push (done) =>
@upload file.name, path, file.hash, done
Expand Down Expand Up @@ -207,6 +200,20 @@ module.exports = (grunt) ->
grunt.log.debug "Diff", util.inspect(diff)
callback(diff)

touchRecursive: (path, callback) ->
segments = path.split(Path.sep)
step = []
commands = []

for segment in segments when segment.length > 0
do (segment) =>
step.push segment
localPath = step.join Path.sep
commands.push (done) => @touch localPath, done

async.parallel commands, callback


touch: (path, callback) ->
grunt.log.debug "Touch", util.inspect(path)

Expand Down

0 comments on commit 257310b

Please sign in to comment.