<commit_before>//jscs:disable jsDoc

var pbjs = require('protobufjs/cli/pbjs.js');
var exec = require('child_process').exec;

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-regex-check');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-babel');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-mkdir');
    grunt.loadNpmTasks('grunt-exec');


    var gruntOptions = {
        skipTests: (process.env.GRUNT_SKIP_TESTS || false) === 'true'
    };

    console.log(gruntOptions);

    /******************************************
     * GRUNT INIT
     ******************************************/

    grunt.initConfig({
        fileConfigOptions: {
            prodHtml: [ 'target/website/index.html', 'target/website/src/**/*.html', '!target/website/src/main/web/utilities/libraries/**/*.html' ],
            prodFiles: [ 'target/website/index.html', 'target/website/src/**/*.html', 'target/website/src/**/*.js',
                '!target/website/src/main/web/utilities/libraries/**/*.js', '!target/website/src/main/web/utilities/libraries/**/*.html' ]
        },
        /**
         * CHECKSTYLE
         */
        jshint: {
            options: {
                jshintrc: 'config/.jshintrc',
                ignores: [ 'src/main/web/utilities/libraries/**/*.js', 'src/test/web/testUtilities/**/*.js' ],
                globals: {
                    module: true
                },
                reporter:'jslint',
                reporterOutput: 'target/jshint.xml'
            },
            files: [ 'Gruntfile.js', 'src/main/web/**/*.js', 'src/test/web/**/*.js',
                '!src/main/web/utilities/libraries/**/*.js', '!src/test/web/**/*.js', '!src/main/web/sketching/srl/objects/**/*.js' ]
        },
        jscs: {
            src: '<%= jshint.files %>',
            options: {
                config: 'config/jscs.conf.jscsrc',
                reporterOutput: 'target/jscsReport.txt',
                maxErrors: 1000
            }
        },
        /*
         * This module is used to check the existence or the lack of existance of a pattern in the given files
         */
        'regex-check': {
            head: {
                files: {
                    src: [ 'src/main/web/**/*.html', 'src/test/web/**/*.html', '!src/main/web/utilities/libraries/**/*.html',
                        'src/main/web/utilities/libraries/**/*Include.html' ]
                },
                options: {
                    // This looks for the head tag <head>
                    pattern: /<head(\s|(.*lang=.*))*>/g,
                    failIfMissing: true
                }
            }
        },
        /**
         * JSDOC
         */
        jsdoc: {
            dist: {
                src: '<%= jshint.files %>',
                options: {
                    destination: 'doc'
                }
            }
        },
        /**
         * Directory Creation
         */
        mkdir: {
            all: {
                options: {
                    create: [ 'target/unitTest', 'target/screenshots', 'target/website/proto' ]
                }
            }
        },
        /**
         * BUILDERS
         */
        exec: {
            build_proto: {
                cmd: function() {
                    var inputFiles = [ 'src/**/proto/**/*.proto' ];
                    var protoFiles = grunt.file.expand(inputFiles);
                    var jsFiles = grunt.file.expandMapping(protoFiles, 'src/main/js/generated_proto', { flatten: true, ext: '.js' });
                    var command = '';
                    for (var i = 0; i < protoFiles.length; i++) {
                        grunt.log.write('cimpiling protofile ' + protoFiles[i]);
                        grunt.log.write('');
                        var jsFile = jsFiles[i].dest;
                        command+= '"./node_modules/.bin/pbjs" ' + protoFiles[i] + ' --source=proto' +
                        //    ' --exports=proto_' + jsFile.replace(/^.*[\\\/]/, '').slice(0, -3) +
                            ' --target=commonjs --path=src/main/proto > ' + jsFile + ' & ';
                    }
                    console.log(command);
                    return command + 'echo "completed compile"';
                }
            }
        },
        babel: {
            options: {
                sourceMap: true
            },
            all: {
                files: [
                    {
                        expand: true,
                        src: [ 'target/website/src/main/web/**/*.js', '!target/website/src/main/web/utilities/libraries/**/*.js' ],
                        dest: '.'
                    }
                ]
            }
        },
        copy: {
            main: {
                files: [
                    {
                        // copies the website files used in production for prod use
                        expand: true,
                        src: [ 'src/main/js/**', '!src/test/**',

                            // we do not want these copied as they are not meant for production.
                            '!src/**/debug/**' ],
                        dest: 'target/website/'
                    },
                    {
                        // copies the bower components to target
                        expand: true,
                        src: [ 'bower_components/protobufjs/**', 'bower_components/bytebuffer/**', 'bower_components/long/**' ],
                        dest: 'target/website/'
                    },
                ]
            },
            /**
             * copies the babel polyfill into the bower_components folder
             */
            babel: {
                files: [
                    {
                        expand: false,<commit_msg>moves all dependencies into the website portion of the codebase<commit_after>//jscs:disable jsDoc

var pbjs = require('protobufjs/cli/pbjs.js');
var exec = require('child_process').exec;

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-jscs');
    grunt.loadNpmTasks('grunt-regex-check');
    grunt.loadNpmTasks('grunt-contrib-jshint');
    grunt.loadNpmTasks('grunt-jsdoc');
    grunt.loadNpmTasks('grunt-babel');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-text-replace');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-mkdir');
    grunt.loadNpmTasks('grunt-exec');


    var gruntOptions = {
        skipTests: (process.env.GRUNT_SKIP_TESTS || false) === 'true'
    };

    console.log(gruntOptions);

    /******************************************
     * GRUNT INIT
     ******************************************/

    grunt.initConfig({
        fileConfigOptions: {
            prodHtml: [ 'target/website/index.html', 'target/website/src/**/*.html', '!target/website/src/main/web/utilities/libraries/**/*.html' ],
            prodFiles: [ 'target/website/index.html', 'target/website/src/**/*.html', 'target/website/src/**/*.js',
                '!target/website/src/main/web/utilities/libraries/**/*.js', '!target/website/src/main/web/utilities/libraries/**/*.html' ]
        },
        /**
         * CHECKSTYLE
         */
        jshint: {
            options: {
                jshintrc: 'config/.jshintrc',
                ignores: [ 'src/main/web/utilities/libraries/**/*.js', 'src/test/web/testUtilities/**/*.js' ],
                globals: {
                    module: true
                },
                reporter:'jslint',
                reporterOutput: 'target/jshint.xml'
            },
            files: [ 'Gruntfile.js', 'src/main/web/**/*.js', 'src/test/web/**/*.js',
                '!src/main/web/utilities/libraries/**/*.js', '!src/test/web/**/*.js', '!src/main/web/sketching/srl/objects/**/*.js' ]
        },
        jscs: {
            src: '<%= jshint.files %>',
            options: {
                config: 'config/jscs.conf.jscsrc',
                reporterOutput: 'target/jscsReport.txt',
                maxErrors: 1000
            }
        },
        /*
         * This module is used to check the existence or the lack of existance of a pattern in the given files
         */
        'regex-check': {
            head: {
                files: {
                    src: [ 'src/main/web/**/*.html', 'src/test/web/**/*.html', '!src/main/web/utilities/libraries/**/*.html',
                        'src/main/web/utilities/libraries/**/*Include.html' ]
                },
                options: {
                    // This looks for the head tag <head>
                    pattern: /<head(\s|(.*lang=.*))*>/g,
                    failIfMissing: true
                }
            }
        },
        /**
         * JSDOC
         */
        jsdoc: {
            dist: {
                src: '<%= jshint.files %>',
                options: {
                    destination: 'doc'
                }
            }
        },
        /**
         * Directory Creation
         */
        mkdir: {
            all: {
                options: {
                    create: [ 'target/unitTest', 'target/screenshots', 'target/website/proto' ]
                }
            }
        },
        /**
         * BUILDERS
         */
        exec: {
            build_proto: {
                cmd: function() {
                    var inputFiles = [ 'src/**/proto/**/*.proto' ];
                    var protoFiles = grunt.file.expand(inputFiles);
                    var jsFiles = grunt.file.expandMapping(protoFiles, 'src/main/js/generated_proto', { flatten: true, ext: '.js' });
                    var command = '';
                    for (var i = 0; i < protoFiles.length; i++) {
                        grunt.log.write('cimpiling protofile ' + protoFiles[i]);
                        grunt.log.write('');
                        var jsFile = jsFiles[i].dest;
                        command+= '"./node_modules/.bin/pbjs" ' + protoFiles[i] + ' --source=proto' +
                        //    ' --exports=proto_' + jsFile.replace(/^.*[\\\/]/, '').slice(0, -3) +
                            ' --target=commonjs --path=src/main/proto > ' + jsFile + ' & ';
                    }
                    console.log(command);
                    return command + 'echo "completed compile"';
                }
            }
        },
        babel: {
            options: {
                sourceMap: true
            },
            all: {
                files: [
                    {
                        expand: true,
                        src: [ 'target/website/src/main/web/**/*.js', '!target/website/src/main/web/utilities/libraries/**/*.js' ],
                        dest: '.'
                    }
                ]
            }
        },
        copy: {
            main: {
                files: [
                    {
                        // copies the website files used in production for prod use
                        expand: true,
                        src: [ '**' ],
                        dest: 'target/website/',
                        cwd: 'src/main/js'
                    },
                    {
                        // copies the bower components to target
                        expand: true,
                        src: [ '**/*.js' ],
                        dest: 'target/website/',
                        cwd: 'bower_components'
                    }
                ]
            },
            /**
             * copies the babel polyfill into the bower_components folder
             */
            babel: {
                files: [
                    {
                        expand: false,
{'fraction_non_alphanumeric': 0.1609088605456542, 'fraction_numerical': 0.0011825323084719993, 'mean_word_length': 1.1597956950018242, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '3455820', 'n_tokens_mistral': 3412, 'n_tokens_neox': 3212, 'n_words': 500}