Skip to content

Commit

Permalink
Only copy files right from source. Do not recurse into sub-directorie…
Browse files Browse the repository at this point in the history
…s. Fixes problems with .svn/ and such
  • Loading branch information
brandonramirez committed Nov 12, 2012
1 parent b809f6e commit 2a9d6ec
Showing 1 changed file with 24 additions and 4 deletions.
28 changes: 24 additions & 4 deletions lib/buildr.coffee
Expand Up @@ -350,10 +350,30 @@ class Buildr
return next err if err

# Copy srcPath to outPath
util.cpdir config.srcPath, config.outPath, (err) ->
# Next
log 'debug', "Copied #{config.srcPath} to #{config.outPath}"
next err
fs.mkdir config.outPath, (mkdirError) ->
return next mkdirError if mkdirError

fs.readdir config.srcPath, (err, files) ->
return next err if err

copyableFiles = []

statTasks = new util.Group (groupError) ->
copyTasks = new util.Group (groupError) ->
log 'debug', "Copied #{config.srcPath} to #{config.outPath}"
next err

copyTasks.total = copyableFiles.length
copyableFiles.forEach (file) ->
fs.readFile config.srcPath + '/' + file, 'utf8', (err, data) ->
fs.writeFile config.outPath + '/' + file, data, 'utf8', copyTasks.completer()

statTasks.total = files.length

files.forEach (file) ->
fs.stat config.srcPath + '/' + file, (error, stat) ->
copyableFiles.push(file) if stat.isFile()
statTasks.completer()()

# Completed
true
Expand Down

0 comments on commit 2a9d6ec

Please sign in to comment.