     # wrench returned file list
     matchFiles files
 
-# default cachebust filename gen function
-defaultCbfn = (root, file) ->
-  # replace this with checksum
-  return "#{file}.cacheout"
+# default cachebust file generator
+defaultFileGen = (root, dest, filePath, callback) ->
+  # read in file
+  file = fs.readFileSync("#{root}/#{filePath}")
+
+  # generate new filename
+  genFilePath = "#{filePath}.cacheout"
+
+  # write new file
+  writeFile "#{dest}/#{genFilePath}", file, (error) ->
+    return callback error, null if error?
+
+    # return generated file path
+    callback null, genFilePath
 
 # Create copy of asset files in `root` that match any of the regex patterns
 # passed in `match` with cache busting filename in `dest` folder.

  console.log [srcPath, outPath, assetFiles, sourceFiles]

  createCachebustedAssets srcPath, outPath, assetFiles, (e, f) ->
    console.log "cacheit::createCachebustedAssets: response", e, f

  return
  # get list of assets
  findFiles srcPath, assetFiles, (error, foundFiles) ->
    return logger.error error if error?
    console.log "Asset Files:", foundFiles


#
# root (string) Root path to search for asset files.
# dest (string) Path to create new cache busting asset files.
# callback (function) Function called on error or success, cb(error, genFiles)
#                 - On error called with error set, genFiles null
#                 - On success error null and genFiles set as dict
#                   original file path key and the value being the new
# fileGenFn (function) Function that generates cache busting file taking the
#                 following arguments:
#                     root (str) Root path searched in
#                     file (str) Path to file from `root`
createCachebustedAssets = (root, dest, match, callback, fileGenFn = defaultFileGen) ->
  genFiles = {}

  findFilesComplete = ->
    callback null, genFiles

  findFiles root, match, (error, file) ->
    # error: pass error back to callback
    return callback e, null if error?

    # finished
    return findFilesComplete() unless file? or error?

    # match: create new cachebust file and store details
    fileGenFn root, dest, file, (error, gfile) ->
      # error: pass error back to callback
      return callback error, null if error?

      genFiles[file] = gfile

module.exports = cacheit = (options, callback = (->)) ->
  config = helpers.loadConfig options.configPath
