<commit_before>#!/usr/bin/env node

var source = "resources/android/custom/";
var android_dests = [
  "res/drawable-ldpi-v4/",
  "res/drawable-mdpi-v4/",
  "res/drawable-hdpi-v4/",
  "res/drawable-xhdpi-v4/",
  "res/drawable-xxhdpi-v4/",
  "res/drawable-xxxhdpi-v4/",
  "res/drawable-ldpi/",
  "res/drawable-mdpi/",
  "res/drawable-hdpi/",
  "res/drawable-xhdpi/",
  "res/drawable-xxhdpi/",
  "res/drawable-xxxhdpi/"
];


module.exports = function(ctx) {
  if (ctx.opts.platforms.indexOf('android') < 0) {
    return;
  }

  var fs = ctx.requireCordovaModule('fs');
  var path = ctx.requireCordovaModule('path');
  var Q = ctx.requireCordovaModule('q');

  var android_rootdir = path.join(ctx.opts.projectRoot, 'platforms/android');

  function copy(src, dest_dir, file) {
    var deferred = Q.defer();

    if (fs.existsSync(src) && fs.existsSync(dest_dir)) {
      deferred.resolve(fs.createReadStream(src).pipe(fs.createWriteStream(path.join(dest_dir, file))));
    } else {
      deferred.resolve();
    }

    return deferred.promise;
  }

  var promise = Q(-1);

  fs.readdir(path.join(ctx.opts.projectRoot, source), function(err, files) {
    files.forEach(function(file) {
      android_dests.forEach(function(destination) {
        return copy(path.join(ctx.opts.projectRoot, source + file), path.join(android_rootdir, destination), file);
      });
    });
  });

  return promise;<commit_msg>General format cleanup<commit_after>#!/usr/bin/env node

var fs = require('fs');
var path = require('path');

var platformDir = 'platforms/android';
var source = 'resources/android/custom/';
var resourceDirs = [
  'res/drawable-ldpi-v4/',
  'res/drawable-mdpi-v4/',
  'res/drawable-hdpi-v4/',
  'res/drawable-xhdpi-v4/',
  'res/drawable-xxhdpi-v4/',
  'res/drawable-xxxhdpi-v4/',
  'res/drawable-ldpi/',
  'res/drawable-mdpi/',
  'res/drawable-hdpi/',
  'res/drawable-xhdpi/',
  'res/drawable-xxhdpi/',
  'res/drawable-xxxhdpi/'
];

function copy(src, dest, file) {
  var deferred = Q.defer();

  if (fs.existsSync(src) && fs.existsSync(dest)) {
    deferred.resolve(fs.createReadStream(src).pipe(fs.createWriteStream(path.join(dest, file))));
  } else {
    deferred.resolve();
  }

  return deferred.promise;
}

module.exports = function(ctx) {
  if (ctx.opts.platforms.indexOf('android') < 0) {
    return;
  }

  var Q = ctx.requireCordovaModule('q');
  var deferred = Q.defer();
  var androidPlatformDir = path.join(ctx.opts.projectRoot, platformDir);

  fs.readdir(path.join(ctx.opts.projectRoot, source), function(err, files) {
    files.forEach(function(file) {
      resourceDirs.forEach(function(destination) {
        return copy(path.join(ctx.opts.projectRoot, source + file), path.join(androidPlatformDir, destination), file);
      });
    });
  });

  return deferred.promise;
{'fraction_non_alphanumeric': 0.17788117394416608, 'fraction_numerical': 0.005368647100930566, 'mean_word_length': 3.753401360544218, 'pattern_counts': {'":': 0, '<': 5, '<?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': '1975844', 'n_tokens_mistral': 1066, 'n_tokens_neox': 1016, 'n_words': 148}