<commit_before>'use strict';
var path = require('path'),
    fs = require('fs');

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        concat: {
            dist: {
                src: ['lib/header.js', 'lib/**/*.js'],
                dest: 'nodeload.js'
            }
        },
        jshint: {
            gruntfile: ['Gruntfile.js'],
            libs_n_tests: ['lib/**/*.js'],
            options: grunt.file.readJSON(path.join(__dirname,'.jshintrc'))
        },
        watch: {
            gruntfile: {
                files: ['<%= jshint.gruntfile %>'],
                tasks: ['jshint:gruntfile']
            },
            libs_n_tests: {
                files: ['<%= jshint.libs_n_tests %>'],
                tasks: ['jshint:libs_n_tests']
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // "npm test" runs these tasks
    grunt.registerTask('test', ['jshint']);

    // Default task.
    grunt.registerTask('default', ['test']);

    grunt.registerTask('clean-templates', 'Clean reoprt templates.', function() {
        var msg = grunt.log.write('Cleaning up ./lib/reporting/*.tpl.js ...').ok();
    });

    grunt.registerTask('compile-templates', 'Compiling report templates.', function() {
        var summary = fs.openSync('lib/reporting/summary.tpl.js', 'a'),
            dygraph = fs.openSync('lib/reporting/dygraph.tpl.js', 'a');
        grunt.util.async.waterfall([
            function(done){
                grunt.util.spawn({
                    cmd: 'node',
                    args: ['scripts/process_tpl.js', 'REPORT_SUMMARY_TEMPLATE', 'lib/reporting/summary.tpl'],
                    opts: { stdio: ['pipe', summary, 'pipe'] }
                }, function(error, result) {
                    if (!error) {<commit_msg>Updated Gruntfile with clean-templates logic<commit_after>'use strict';
var path = require('path'),
    fs = require('fs');

module.exports = function(grunt) {

    // Project configuration.
    grunt.initConfig({
        concat: {
            dist: {
                src: ['lib/header.js', 'lib/**/*.js'],
                dest: 'nodeload.js'
            }
        },
        jshint: {
            gruntfile: ['Gruntfile.js'],
            libs_n_tests: ['lib/**/*.js'],
            options: grunt.file.readJSON(path.join(__dirname,'.jshintrc'))
        },
        watch: {
            gruntfile: {
                files: ['<%= jshint.gruntfile %>'],
                tasks: ['jshint:gruntfile']
            },
            libs_n_tests: {
                files: ['<%= jshint.libs_n_tests %>'],
                tasks: ['jshint:libs_n_tests']
            }
        }
    });

    // These plugins provide necessary tasks.
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-contrib-watch');

    // "npm test" runs these tasks
    grunt.registerTask('test', ['jshint']);

    // Default task.
    grunt.registerTask('default', ['test', 'clean-templates', 'compile-templates']);

    grunt.registerTask('clean-templates', 'Clean reoprt templates.', function() {
        grunt.log.write('Cleaning up ./lib/reporting/*.tpl.js ...');

        fs.unlinkSync('lib/reporting/summary.tpl.js');
        fs.unlinkSync('lib/reporting/dygraph.tpl.js');

        grunt.log.ok('Removed lib/reporting/*.tpl.js');
    });

    grunt.registerTask('compile-templates', 'Compiling report templates.', function() {
        var summary = fs.openSync('lib/reporting/summary.tpl.js', 'a'),
            dygraph = fs.openSync('lib/reporting/dygraph.tpl.js', 'a');
        grunt.util.async.waterfall([
            function(done){
                grunt.util.spawn({
                    cmd: 'node',
                    args: ['scripts/process_tpl.js', 'REPORT_SUMMARY_TEMPLATE', 'lib/reporting/summary.tpl'],
                    opts: { stdio: ['pipe', summary, 'pipe'] }
                }, function(error, result) {
                    if (!error) {
{'fraction_non_alphanumeric': 0.16748647319232662, 'fraction_numerical': 0.0, 'mean_word_length': 1.8762376237623761, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '856120', 'n_tokens_mistral': 1278, 'n_tokens_neox': 1217, 'n_words': 199}