<commit_before>var path = require("path")
var fs = require("fs")
var mkdirp = require("mkdirp")

/**
 * @return {Adapter}
 * */
function dustin( setup ){
  return new Adapter(setup)
}

module.exports = dustin

var dust = dustin.dust = require("dustjs-linkedin")
var helpers = require("dustjs-helpers")
dust.helpers = helpers.helpers


var origFormatter = dust.optimizers.format

dustin.preserveWhiteSpace = function ( preserve ){
  if ( preserve ) {
    dust.optimizers.format = origFormatter
  }
  else {
    dust.optimizers.format = function ( ctx, node ){ return node }
  }
}

function copy( src, dest ){
  mkdirp.sync(path.dirname(dest))
  fs.createReadStream(src)
    .pipe(fs.createWriteStream(dest))
  console.log("Copied client libs: '%s'", dest)
}

/**
 * Copy all dist files from the dust repo to the destination
 * and concat the onLoad function to each them.
 * */
dustin.copyClient = function ( dest, resolvePath ){
  var onLoad = dustin.read(path.join(__dirname, "client/onLoad.js"))
    , scripts = [
      "dust-core.js",
      "dust-core.min.js",
      "dust-full.js",
      "dust-full.min.js"
    ]
  onLoad = onLoad.replace(/"resolvePath"/, '"'+resolvePath+'"')
  scripts.forEach(function doCopy( clientScript ){
    var destPath = path.join(process.cwd(), dest, clientScript)
    var clientPath = path.join(__dirname, "node_modules/dustjs-linkedin/dist", clientScript)
    var script = dustin.read(clientPath)
    script += ";\n"+onLoad
    fs.writeFileSync(destPath, script, "utf8")
  })
}

dustin.read = function ( src ){
  try {
    return fs.readFileSync(src, "utf8")
  }<commit_msg>mkdir for client code copy<commit_after>var path = require("path")
var fs = require("fs")
var mkdirp = require("mkdirp")

/**
 * @return {Adapter}
 * */
function dustin( setup ){
  return new Adapter(setup)
}

module.exports = dustin

var dust = dustin.dust = require("dustjs-linkedin")
var helpers = require("dustjs-helpers")
dust.helpers = helpers.helpers

var origFormatter = dust.optimizers.format

dustin.preserveWhiteSpace = function ( preserve ){
  if ( preserve ) {
    dust.optimizers.format = origFormatter
  }
  else {
    dust.optimizers.format = function ( ctx, node ){ return node }
  }
}

function copy( src, dest ){
  mkdirp.sync(path.dirname(dest))
  fs.createReadStream(src)
    .pipe(fs.createWriteStream(dest))
  console.log("Copied client libs: '%s'", dest)
}

/**
 * Copy all dist files from the dust repo to the destination
 * and concat the onLoad function to each them.
 * */
dustin.copyClient = function ( dest, resolvePath ){
  var onLoad = dustin.read(path.join(__dirname, "client/onLoad.js"))
    , scripts = [
      "dust-core.js",
      "dust-core.min.js",
      "dust-full.js",
      "dust-full.min.js"
    ]
  onLoad = onLoad.replace(/"resolvePath"/, '"'+resolvePath+'"')
  scripts.forEach(function doCopy( clientScript ){
    var destPath = path.join(process.cwd(), dest, clientScript)
    var clientPath = path.join(__dirname, "node_modules/dustjs-linkedin/dist", clientScript)
    var script = dustin.read(clientPath)
    script += ";\n"+onLoad
    mkdirp.sync(path.dirname(destPath))
    fs.writeFileSync(destPath, script, "utf8")
  })
}

dustin.read = function ( src ){
  try {
    return fs.readFileSync(src, "utf8")
  }
{'fraction_non_alphanumeric': 0.14696876913655849, 'fraction_numerical': 0.001224739742804654, 'mean_word_length': 3.7142857142857144, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1133560', 'n_tokens_mistral': 1112, 'n_tokens_neox': 1087, 'n_words': 245}