<commit_before>var fs = require("fs");
var path = require("path");
var util = require("util");
var exec = require("child_process").exec;
var uglifyJs = require("uglify-js");
var rimraf = require("rimraf");
var jshint = require("jshint");
var archiver = require("archiver");

var FILE_ENCODING = "utf-8";

var buildSpec = {
    baseVersion: "1.3.0-alpha",
    gitUrl: "https://github.com/timdown/rangy.git",
    gitBranch: "master"
};

var buildDir = "dist/";

var gitDir = buildDir + "repository/", srcDir = gitDir + "src/";
var zipDir;
var uncompressedBuildDir;
var coreFilename = "rangy-core.js";
var modules = [
    "rangy-classapplier.js",
    "rangy-serializer.js",
    "rangy-selectionsaverestore.js",
    "rangy-textrange.js",
    "rangy-highlighter.js"
];

var allScripts = [coreFilename].concat(modules);

var buildVersion;

function concat(fileList, destPath) {
    var out = fileList.map(function(filePath) {
        return fs.readFileSync(filePath, FILE_ENCODING);
    });
    fs.writeFileSync(destPath, out.join("\n"), FILE_ENCODING);
}

function copyFileSync(srcFile, destFile, preserveTimestamps) {
    var contents = fs.readFileSync(srcFile);
    fs.writeFileSync(destFile, contents);
    var stat = fs.lstatSync(srcFile);
    fs.chmodSync(destFile, stat.mode);
    if (preserveTimestamps) {
        fs.utimesSync(destFile, stat.atime, stat.mtime)
    }
}

function copyFiles(srcDir, destDir, recursive, fileNameTransformer) {
    if (fs.existsSync(destDir)) {
        if (!fs.statSync(destDir).isDirectory()) {
            throw new Error("Destination exists and is not a directory");
        }
    } else {
        fs.mkdirSync(destDir, fs.statSync(srcDir).mode);
    }

    var files = fs.readdirSync(srcDir);

    Array.prototype.forEach.call(files, function(fileName) {
        var srcFilePath = path.join(srcDir, fileName);
        var destFilePath = path.join(destDir, fileName);
        var srcFileInfo = fs.lstatSync(srcFilePath);

        if (srcFileInfo.isDirectory()) {
            if (recursive) {
                copyFiles(srcFilePath, destFilePath, true, fileNameTransformer);
            }
        } else if (srcFileInfo.isSymbolicLink()) {
            throw new Error("Symbolic links are not supported");
        } else {
            if (fileNameTransformer) {
                destFilePath = fileNameTransformer(destFilePath);
            }
            copyFileSync(srcFilePath, destFilePath);
        }
    });
}

function copyFilesRecursive(srcDir, destDir, fileNameTransformer) {
    copyFiles(srcDir, destDir, true, fileNameTransformer);
}

function deleteBuildDir() {
    // Delete the old build directory
    if (fs.existsSync(buildDir)) {
        rimraf(buildDir, function() {
            console.log("Deleted old build directory");
            callback();
        });
    } else {
        console.log("No existing build directory");
        callback();
    }
}

function createBuildDir() {
    fs.mkdirSync(buildDir);
    fs.mkdirSync(gitDir);
    console.log("Created build directory " + path.resolve(buildDir));
    callback();
}

function cloneGitRepository() {
    var cloneCmd = "git clone " + buildSpec.gitUrl + " " + gitDir;
    console.log("Cloning Git repository: " + cloneCmd);
    exec(cloneCmd, function(error, stdout, stderr) {
        console.log("Cloned Git repository");
        callback();
    });
}<commit_msg>Modify build scripts to point to peitschie/rangy.git<commit_after>var fs = require("fs");
var path = require("path");
var util = require("util");
var exec = require("child_process").exec;
var uglifyJs = require("uglify-js");
var rimraf = require("rimraf");
var jshint = require("jshint");
var archiver = require("archiver");

var FILE_ENCODING = "utf-8";

var buildSpec = {
    baseVersion: "1.3.0-alpha",
    gitUrl: "https://github.com/peitschie/rangy.git",
    gitBranch: "perf-master"
};

var buildDir = "dist/";

var gitDir = buildDir + "repository/", srcDir = gitDir + "src/";
var zipDir;
var uncompressedBuildDir;
var coreFilename = "rangy-core.js";
var modules = [
    "rangy-classapplier.js",
    "rangy-serializer.js",
    "rangy-selectionsaverestore.js",
    "rangy-textrange.js",
    "rangy-highlighter.js"
];

var allScripts = [coreFilename].concat(modules);

var buildVersion;

function concat(fileList, destPath) {
    var out = fileList.map(function(filePath) {
        return fs.readFileSync(filePath, FILE_ENCODING);
    });
    fs.writeFileSync(destPath, out.join("\n"), FILE_ENCODING);
}

function copyFileSync(srcFile, destFile, preserveTimestamps) {
    var contents = fs.readFileSync(srcFile);
    fs.writeFileSync(destFile, contents);
    var stat = fs.lstatSync(srcFile);
    fs.chmodSync(destFile, stat.mode);
    if (preserveTimestamps) {
        fs.utimesSync(destFile, stat.atime, stat.mtime)
    }
}

function copyFiles(srcDir, destDir, recursive, fileNameTransformer) {
    if (fs.existsSync(destDir)) {
        if (!fs.statSync(destDir).isDirectory()) {
            throw new Error("Destination exists and is not a directory");
        }
    } else {
        fs.mkdirSync(destDir, fs.statSync(srcDir).mode);
    }

    var files = fs.readdirSync(srcDir);

    Array.prototype.forEach.call(files, function(fileName) {
        var srcFilePath = path.join(srcDir, fileName);
        var destFilePath = path.join(destDir, fileName);
        var srcFileInfo = fs.lstatSync(srcFilePath);

        if (srcFileInfo.isDirectory()) {
            if (recursive) {
                copyFiles(srcFilePath, destFilePath, true, fileNameTransformer);
            }
        } else if (srcFileInfo.isSymbolicLink()) {
            throw new Error("Symbolic links are not supported");
        } else {
            if (fileNameTransformer) {
                destFilePath = fileNameTransformer(destFilePath);
            }
            copyFileSync(srcFilePath, destFilePath);
        }
    });
}

function copyFilesRecursive(srcDir, destDir, fileNameTransformer) {
    copyFiles(srcDir, destDir, true, fileNameTransformer);
}

function deleteBuildDir() {
    // Delete the old build directory
    if (fs.existsSync(buildDir)) {
        rimraf(buildDir, function() {
            console.log("Deleted old build directory");
            callback();
        });
    } else {
        console.log("No existing build directory");
        callback();
    }
}

function createBuildDir() {
    fs.mkdirSync(buildDir);
    fs.mkdirSync(gitDir);
    console.log("Created build directory " + path.resolve(buildDir));
    callback();
}

function cloneGitRepository() {
    var cloneCmd = "git clone -b" + buildSpec.gitBranch + " " + buildSpec.gitUrl + " " + gitDir;
    console.log("Cloning Git repository: " + cloneCmd);
    exec(cloneCmd, function(error, stdout, stderr) {
        console.log("Cloned Git repository");
        callback();
    });
}
{'fraction_non_alphanumeric': 0.13310830642794247, 'fraction_numerical': 0.001174053419430584, 'mean_word_length': 3.147900182592818, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '2591054', 'n_tokens_mistral': 2146, 'n_tokens_neox': 2116, 'n_words': 440}