Skip to content
This repository
Browse code

Only copy files right from source. Do not recurse into sub-directorie…

…s. Fixes problems with .svn/ and such
  • Loading branch information...
commit 2a9d6ec7312a8bcb7257f1b333cd83e5fbaa9817 1 parent b809f6e
Brandon Ramirez authored November 11, 2012

Showing 1 changed file with 24 additions and 4 deletions. Show diff stats Hide diff stats

  1. 28  lib/buildr.coffee
28  lib/buildr.coffee
@@ -350,10 +350,30 @@ class Buildr
350 350
 			return next err	 if err
351 351
 
352 352
 			# Copy srcPath to outPath
353  
-			util.cpdir config.srcPath, config.outPath, (err) ->
354  
-				# Next
355  
-				log 'debug', "Copied #{config.srcPath} to #{config.outPath}"
356  
-				next err
  353
+			fs.mkdir config.outPath, (mkdirError) ->
  354
+				return next mkdirError if mkdirError
  355
+
  356
+				fs.readdir config.srcPath, (err, files) ->
  357
+					return next err if err
  358
+
  359
+					copyableFiles = []
  360
+
  361
+					statTasks = new util.Group (groupError) ->
  362
+						copyTasks = new util.Group (groupError) ->
  363
+							log 'debug', "Copied #{config.srcPath} to #{config.outPath}"
  364
+							next err
  365
+
  366
+						copyTasks.total = copyableFiles.length
  367
+						copyableFiles.forEach (file) ->
  368
+							fs.readFile config.srcPath + '/' + file, 'utf8', (err, data) ->
  369
+								fs.writeFile config.outPath + '/' + file, data, 'utf8', copyTasks.completer()
  370
+
  371
+					statTasks.total = files.length
  372
+
  373
+					files.forEach (file) ->
  374
+						fs.stat config.srcPath + '/' + file, (error, stat) ->
  375
+							copyableFiles.push(file) if stat.isFile()
  376
+							statTasks.completer()()
357 377
 	
358 378
 		# Completed
359 379
 		true

0 notes on commit 2a9d6ec

Please sign in to comment.
Something went wrong with that request. Please try again.