From 2a9d6ec7312a8bcb7257f1b333cd83e5fbaa9817 Mon Sep 17 00:00:00 2001 From: Brandon Ramirez Date: Sun, 11 Nov 2012 21:38:48 -0500 Subject: [PATCH] Only copy files right from source. Do not recurse into sub-directories. Fixes problems with .svn/ and such --- lib/buildr.coffee | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) diff --git a/lib/buildr.coffee b/lib/buildr.coffee index 9279998..c6d0559 100644 --- a/lib/buildr.coffee +++ b/lib/buildr.coffee @@ -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