<commit_before>module.exports = function (grunt) {
    "use strict";

    var sourceFiles = grunt.file.readJSON("sourceFiles.json");
    var testSpecs = grunt.file.readJSON("testSpecs.json");

    // Project configuration.
    grunt.initConfig({
        pkg : grunt.file.readJSON("package.json"),
        path : {
            main : "build/<%= pkg.name %>-<%= pkg.version %>.js",
            min : "build/<%= pkg.name %>-<%= pkg.version %>-min.js"
        },

        concat : {
            dist : {
                src : sourceFiles,
                dest : "<%= path.main %>"
            }
        },

        replace : {
            dist : {
                options : {
                    variables : {
                        "__FRAGMENT__" : "<%= grunt.file.read('build/quad-fragment.glsl') %>",
                        "__VERTEX__" : "<%= grunt.file.read('build/quad-vertex.glsl') %>",
                        "__VERSION__" : "<%= pkg.version %>"
                    },
                    usePrefix : false,
                    force : true,
                    patterns : [
                        {
                            match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
                            replacement : "$1.prototype.$2.apply(this$3"
                        },
                    ],
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ "<%= path.main %>" ],
                        dest : "build/"
                    }
                ]
            },

            docs : {
                options : {
                    variables : {
                        "VERSION" : "<%= pkg.version %>"
                    },
                    prefix : "@",
                    force : true
                },
                files : [
                    {
                        expand : true,
                        src : sourceFiles.concat([ "README.md" ]),
                        dest : "build/docs/"
                    }
                ]
            },

            glsl : {
                options : {
                    preserveOrder : true,
                    patterns : [
                        {
                            // Remove comments
                            match : /(\/\/.*?\\n)|(\/\*(.|\\n)*?\*\/)/g,
                            replacement : ""
                        },
                        {
                            // Remove leading and trailing whitespace from lines
                            match : /(\\n\s+)|(\s+\\n)/g,
                            replacement : ""
                        },
                        {
                            // Remove line breaks
                            match : /(\\r|\\n)+/g,
                            replacement : ""
                        },
                        {
                            // Remove unnecessary whitespace
                            match : /\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g,
                            replacement : "$1"
                        },
                    ],
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ "build/*.glsl" ],
                        dest : "build/"
                    }
                ]
            }
        },

        dot : {
            glsl : {
                options : {
                    strip : false,
                },
                files : [
                    {
                        src : "src/video/webgl/glsl/",
                        dest : "build/"
                    }
                ]
            }
        },

        uglify : {
            options : {
                report : "min",
                preserveComments : "some"
            },
            dist : {
                files : {
                    "<%= path.min %>" : [
                        "<%= path.main %>"
                    ]
                }
            }
        },

        jshint : {
            options : {
                jshintrc : ".jshintrc"
            },

            beforeConcat : {
                files : {
                    src : [
                        testSpecs,
                        sourceFiles,
                        "Gruntfile.js",
                        "plugins/**/*"
                    ]
                }
            },

            afterConcat : {
                files : {
                    src : [ "<%= path.main %>" ]
                }
            }
        },

        clean : {
            dist : [
                "<%= path.main %>",
                "<%= path.min %>"
            ],
            jsdoc : [
                "build/docs",
                "./docs/**/*.*",
                "./docs/scripts",
                "./docs/styles",
                "./docs/images",
                "./docs/img"
            ]
        },

        jsdoc : {
            dist : {
                src : sourceFiles.map(function (value) {
                    return value.replace("src/", "build/docs/src/");
                }).concat([ "README.md" ]),
                options : {
                    configure : "jsdoc_conf.json",
                    destination : "docs",
                    template : "tasks/jsdoc-template/template"
                }
            }
        },

        jasmine : {
            src : sourceFiles,
            options : {
                specs : testSpecs,
                helpers : [ "tests/spec/helper-spec.js" ],
                host : "http://localhost:8889/"
            }
        },

        connect : {
            server : {
                options : {
                    port : 8889
                }
            },

            keepalive : {
                options : {
                    port : 8889,
                    keepalive : true
                }
            }
        },
    });

    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-jsdoc");
    grunt.loadNpmTasks("grunt-replace");
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-contrib-connect");

    // Custom Tasks
    grunt.loadTasks("tasks");

    // Default task.
    grunt.registerTask("default", [ "test", "uglify" ]);
    grunt.registerTask("build", [ "lint", "uglify" ]);
    grunt.registerTask("glsl", [ "dot:glsl", "replace:glsl" ]);
    grunt.registerTask("lint", [
        "jshint:beforeConcat",
        "glsl",
        "concat",
        "replace:dist",
        "jshint:afterConcat"
    ]);
    grunt.registerTask("doc", [ "replace:docs", "jsdoc" ]);
    grunt.registerTask("test", [ "lint", "connect:server", "jasmine" ]);
};
<commit_msg>Test the build file in Jasmine, instead of source files<commit_after>module.exports = function (grunt) {
    "use strict";

    var sourceFiles = grunt.file.readJSON("sourceFiles.json");
    var testSpecs = grunt.file.readJSON("testSpecs.json");

    // Project configuration.
    grunt.initConfig({
        pkg : grunt.file.readJSON("package.json"),
        path : {
            main : "build/<%= pkg.name %>-<%= pkg.version %>.js",
            min : "build/<%= pkg.name %>-<%= pkg.version %>-min.js"
        },

        concat : {
            dist : {
                src : sourceFiles,
                dest : "<%= path.main %>"
            }
        },

        replace : {
            dist : {
                options : {
                    variables : {
                        "__FRAGMENT__" : "<%= grunt.file.read('build/quad-fragment.glsl') %>",
                        "__VERTEX__" : "<%= grunt.file.read('build/quad-vertex.glsl') %>",
                        "__VERSION__" : "<%= pkg.version %>"
                    },
                    usePrefix : false,
                    force : true,
                    patterns : [
                        {
                            match : /this\._super\(\s*([\w\.]+)\s*,\s*"(\w+)"\s*(,\s*)?/g,
                            replacement : "$1.prototype.$2.apply(this$3"
                        },
                    ],
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ "<%= path.main %>" ],
                        dest : "build/"
                    }
                ]
            },

            docs : {
                options : {
                    variables : {
                        "VERSION" : "<%= pkg.version %>"
                    },
                    prefix : "@",
                    force : true
                },
                files : [
                    {
                        expand : true,
                        src : sourceFiles.concat([ "README.md" ]),
                        dest : "build/docs/"
                    }
                ]
            },

            glsl : {
                options : {
                    preserveOrder : true,
                    patterns : [
                        {
                            // Remove comments
                            match : /(\/\/.*?\\n)|(\/\*(.|\\n)*?\*\/)/g,
                            replacement : ""
                        },
                        {
                            // Remove leading and trailing whitespace from lines
                            match : /(\\n\s+)|(\s+\\n)/g,
                            replacement : ""
                        },
                        {
                            // Remove line breaks
                            match : /(\\r|\\n)+/g,
                            replacement : ""
                        },
                        {
                            // Remove unnecessary whitespace
                            match : /\s*([;,[\](){}\\\/\-+*|^&!=<>?~%])\s*/g,
                            replacement : "$1"
                        },
                    ],
                },
                files : [
                    {
                        expand : true,
                        flatten : true,
                        src : [ "build/*.glsl" ],
                        dest : "build/"
                    }
                ]
            }
        },

        dot : {
            glsl : {
                options : {
                    strip : false,
                },
                files : [
                    {
                        src : "src/video/webgl/glsl/",
                        dest : "build/"
                    }
                ]
            }
        },

        uglify : {
            options : {
                report : "min",
                preserveComments : "some"
            },
            dist : {
                files : {
                    "<%= path.min %>" : [
                        "<%= path.main %>"
                    ]
                }
            }
        },

        jshint : {
            options : {
                jshintrc : ".jshintrc"
            },

            beforeConcat : {
                files : {
                    src : [
                        testSpecs,
                        sourceFiles,
                        "Gruntfile.js",
                        "plugins/**/*"
                    ]
                }
            },

            afterConcat : {
                files : {
                    src : [ "<%= path.main %>" ]
                }
            }
        },

        clean : {
            dist : [
                "<%= path.main %>",
                "<%= path.min %>"
            ],
            jsdoc : [
                "build/docs",
                "./docs/**/*.*",
                "./docs/scripts",
                "./docs/styles",
                "./docs/images",
                "./docs/img"
            ]
        },

        jsdoc : {
            dist : {
                src : sourceFiles.map(function (value) {
                    return value.replace("src/", "build/docs/src/");
                }).concat([ "README.md" ]),
                options : {
                    configure : "jsdoc_conf.json",
                    destination : "docs",
                    template : "tasks/jsdoc-template/template"
                }
            }
        },

        jasmine : {
            src : "build/<%= pkg.name %>-<%= pkg.version %>.js",
            options : {
                specs : testSpecs,
                helpers : [ "tests/spec/helper-spec.js" ],
                host : "http://localhost:8889/"
            }
        },

        connect : {
            server : {
                options : {
                    port : 8889
                }
            },

            keepalive : {
                options : {
                    port : 8889,
                    keepalive : true
                }
            }
        },
    });

    grunt.loadNpmTasks("grunt-contrib-uglify");
    grunt.loadNpmTasks("grunt-contrib-jshint");
    grunt.loadNpmTasks("grunt-contrib-concat");
    grunt.loadNpmTasks("grunt-contrib-clean");
    grunt.loadNpmTasks("grunt-jsdoc");
    grunt.loadNpmTasks("grunt-replace");
    grunt.loadNpmTasks("grunt-contrib-jasmine");
    grunt.loadNpmTasks("grunt-contrib-connect");

    // Custom Tasks
    grunt.loadTasks("tasks");

    // Default task.
    grunt.registerTask("default", [ "test", "uglify" ]);
    grunt.registerTask("build", [ "lint", "uglify" ]);
    grunt.registerTask("glsl", [ "dot:glsl", "replace:glsl" ]);
    grunt.registerTask("lint", [
        "jshint:beforeConcat",
        "glsl",
        "concat",
        "replace:dist",
        "jshint:afterConcat"
    ]);
    grunt.registerTask("doc", [ "replace:docs", "jsdoc" ]);
    grunt.registerTask("test", [ "lint", "connect:server", "jasmine" ]);
};

{'fraction_non_alphanumeric': 0.13745162677368497, 'fraction_numerical': 0.0022932492475275907, 'mean_word_length': 0.7273177373437306, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, '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': '446422', 'n_tokens_mistral': 3732, 'n_tokens_neox': 3415, 'n_words': 488}