<commit_before> /*
* Gloo gruntfile. Don't modify this file unless you want to change the way Gloo behaves.
* Useage :
* Tasks : dev|release. default is dev
* Additional commands : --gloo JSON, where JSON is a JSON string of GlooConfig overrides.
* */

'use strict';

module.exports = function(grunt) {

    var glooConfigOverride = null;

    // look for custom config passed in as command line arg
    if (grunt.option('gloo')){
        try{
            glooConfigOverride = JSON.parse(grunt.option('gloo'));
            grunt.log.writeln('Using gloo from command line');
        } catch(ex){
            grunt.fail.fatal('--gloo is not valid json.');
        }
    }

    var fs = require('fs'),
        _ = require("lodash"),
        glooConfig = grunt.file.readJSON('gloo-config.json');


    // if config was not passed in as commnandline arg, look for and load user overrides of Gloo settings.
    // This must be in a file '/work/gloo-settings.json' which we assume is adjacen to to gloo folder
    if (!glooConfigOverride){
        glooConfigOverride = fs.existsSync('../gloo-config.json') ? grunt.file.readJSON('../gloo-config.json') : null;
        grunt.log.writeln('Using gloo from gloo-config.json override');
    }

    if (glooConfigOverride){
        _.extend(glooConfig, glooConfigOverride);
    } else {
        grunt.log.writeln('No gloo overrides found. Using default settings.');
    }

    // Set task - allowed options are 'dev' and 'release'. 'dev' is forced if no task is specified.
    var task = grunt.cli.tasks.length > 0 ? grunt.cli.tasks[0] : 'dev',
        mode = task === 'release' ? 'release' : 'dev',
        targetBuildFolder = mode === 'dev'  ? glooConfig.buildFolder : glooConfig.releaseFolder;

    // default grunt settings
    var glooConfig = {

        pkg : grunt.file.readJSON('package.json'),
        glooConfig : glooConfig,

        assemble: {
            options: {
                flatten: true,
                data: ['<%=glooConfig.componentFolder %>/**/*.{json,yml}', '<%=glooConfig.assembleFolder %>/data/**/*.{json,yml}'],
                layoutdir: '<%=glooConfig.assembleFolder %>/layouts',
                helpers: ['<%=glooConfig.assembleFolder %>/helpers/**/*.js', '<%=glooConfig.componentFolder %>/**/*helper.js']
            },
            site: {
                options: {
                    // include layouts in partials list to support using multiarea layouts
                    partials: ['<%=glooConfig.componentFolder %>/**/*.hbs' , '<%=glooConfig.assembleFolder %>/partials/**/*.hbs', '<%=glooConfig.assembleFolder %>/layouts/**/*.hbs' ]
                },
                files: [
                    { expand: true, cwd: '<%=glooConfig.assembleFolder %>/pages', src: ['**/*.hbs'], dest: targetBuildFolder + '/' }
                ]
            }
        },

        compass: {
            default: {
                options: {
                    sassDir: ['temp/scss'],
                    cssDir : targetBuildFolder + '/css'
                }
            }
        },

        bower: {
            default : {
                options : {
                    copy : false
                }
            }
        },

        copy: {
            compiled: {
                files: [
                    { src: [ 'bower_components/requirejs/require.js'], dest : targetBuildFolder + '/lib/require.js', filter: 'isFile' },
                    { src: [ '<%=glooConfig.tempFolder %>/js/require-setup.js'], dest : targetBuildFolder +'/js/gloo.js', filter: 'isFile' }
                ]
            },
            uncompiled: {
                files: [
                    { src: [ 'bower_components/requirejs/require.js'], dest : targetBuildFolder + '/lib/require.js', filter: 'isFile' }
                ]
            },
            update : {
                files : [
                    { expand: true, cwd : './selfClone', src: ['**'], dest : './' },
                ]
            }
        },

        clean: {
            default :[ glooConfig.tempFolder + '/**/*.*']
        },

        concat: {
            base : {
                // js components will be added to this dynamically by transform-js task
                src : [],
                dest: '<%=glooConfig.releaseFolder %>/js/gloo-components.js'
            },
            pages : {
                // js components will be added to this dynamically by transform-js task
                src : [],
                dest: '<%=glooConfig.tempFolder %>/js/pagescript-requirejs-config.js'
            }

        },

        auto_install: {
            local: {}
        }

    };

    // allow grunt settings overrides to be passed in from parent
    _.extend(glooConfig, glooConfigOverride.gruntConfig);

    grunt.initConfig(glooConfig);

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-auto-install');
    grunt.loadNpmTasks('assemble');
    grunt.loadNpmTasks('grunt-bower-task');

    grunt.loadTasks('tasks');

    grunt.registerTask('default', ['dev']);
    grunt.registerTask('init', ['gloo-bower-components']);
    grunt.registerTask('update', ['auto_install', 'copy:update']);
    grunt.registerTask('dev', [
        'clean:default',
        'bower',
        'gloo-vendor-copy',
        'gloo-resolve-components',
        'gloo-check-versions',
        'gloo-build-require-configs:' + mode,
        'gloo-build-js-concat-list:' + mode,<commit_msg>removed breaking extend call from gruntfile.js<commit_after> /*
* Gloo gruntfile. Don't modify this file unless you want to change the way Gloo behaves.
* Useage :
* Tasks : dev|release. default is dev
* Additional commands : --gloo JSON, where JSON is a JSON string of GlooConfig overrides.
* */

'use strict';

module.exports = function(grunt) {

    var glooConfigOverride = null;

    // look for custom config passed in as command line arg
    if (grunt.option('gloo')){
        try{
            glooConfigOverride = JSON.parse(grunt.option('gloo'));
            grunt.log.writeln('Using gloo from command line');
        } catch(ex){
            grunt.fail.fatal('--gloo is not valid json.');
        }
    }

    var fs = require('fs'),
        _ = require("lodash"),
        glooConfig = grunt.file.readJSON('gloo-config.json');


    // if config was not passed in as commnandline arg, look for and load user overrides of Gloo settings.
    // This must be in a file '/work/gloo-settings.json' which we assume is adjacen to to gloo folder
    if (!glooConfigOverride){
        glooConfigOverride = fs.existsSync('../gloo-config.json') ? grunt.file.readJSON('../gloo-config.json') : null;
        grunt.log.writeln('Using gloo from gloo-config.json override');
    }

    if (glooConfigOverride){
        _.extend(glooConfig, glooConfigOverride);
    } else {
        grunt.log.writeln('No gloo overrides found. Using default settings.');
    }

    // Set task - allowed options are 'dev' and 'release'. 'dev' is forced if no task is specified.
    var task = grunt.cli.tasks.length > 0 ? grunt.cli.tasks[0] : 'dev',
        mode = task === 'release' ? 'release' : 'dev',
        targetBuildFolder = mode === 'dev'  ? glooConfig.buildFolder : glooConfig.releaseFolder;

    // default grunt settings
    var glooConfig = {

        pkg : grunt.file.readJSON('package.json'),
        glooConfig : glooConfig,

        assemble: {
            options: {
                flatten: true,
                data: ['<%=glooConfig.componentFolder %>/**/*.{json,yml}', '<%=glooConfig.assembleFolder %>/data/**/*.{json,yml}'],
                layoutdir: '<%=glooConfig.assembleFolder %>/layouts',
                helpers: ['<%=glooConfig.assembleFolder %>/helpers/**/*.js', '<%=glooConfig.componentFolder %>/**/*helper.js']
            },
            site: {
                options: {
                    // include layouts in partials list to support using multiarea layouts
                    partials: ['<%=glooConfig.componentFolder %>/**/*.hbs' , '<%=glooConfig.assembleFolder %>/partials/**/*.hbs', '<%=glooConfig.assembleFolder %>/layouts/**/*.hbs' ]
                },
                files: [
                    { expand: true, cwd: '<%=glooConfig.assembleFolder %>/pages', src: ['**/*.hbs'], dest: targetBuildFolder + '/' }
                ]
            }
        },

        compass: {
            default: {
                options: {
                    sassDir: ['temp/scss'],
                    cssDir : targetBuildFolder + '/css'
                }
            }
        },

        bower: {
            default : {
                options : {
                    copy : false
                }
            }
        },

        copy: {
            compiled: {
                files: [
                    { src: [ 'bower_components/requirejs/require.js'], dest : targetBuildFolder + '/lib/require.js', filter: 'isFile' },
                    { src: [ '<%=glooConfig.tempFolder %>/js/require-setup.js'], dest : targetBuildFolder +'/js/gloo.js', filter: 'isFile' }
                ]
            },
            uncompiled: {
                files: [
                    { src: [ 'bower_components/requirejs/require.js'], dest : targetBuildFolder + '/lib/require.js', filter: 'isFile' }
                ]
            },
            update : {
                files : [
                    { expand: true, cwd : './selfClone', src: ['**'], dest : './' },
                ]
            }
        },

        clean: {
            default :[ glooConfig.tempFolder + '/**/*.*']
        },

        concat: {
            base : {
                // js components will be added to this dynamically by transform-js task
                src : [],
                dest: '<%=glooConfig.releaseFolder %>/js/gloo-components.js'
            },
            pages : {
                // js components will be added to this dynamically by transform-js task
                src : [],
                dest: '<%=glooConfig.tempFolder %>/js/pagescript-requirejs-config.js'
            }

        },

        auto_install: {
            local: {}
        }

    };

    grunt.initConfig(glooConfig);

    grunt.loadNpmTasks('grunt-contrib-clean');
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-compass');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-auto-install');
    grunt.loadNpmTasks('assemble');
    grunt.loadNpmTasks('grunt-bower-task');

    grunt.loadTasks('tasks');

    grunt.registerTask('default', ['dev']);
    grunt.registerTask('init', ['gloo-bower-components']);
    grunt.registerTask('update', ['auto_install', 'copy:update']);
    grunt.registerTask('dev', [
        'clean:default',
        'bower',
        'gloo-vendor-copy',
        'gloo-resolve-components',
        'gloo-check-versions',
        'gloo-build-require-configs:' + mode,
        'gloo-build-js-concat-list:' + mode,
{'fraction_non_alphanumeric': 0.14626405513239027, 'fraction_numerical': 0.0003627130939426913, 'mean_word_length': 1.7999492256918, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 29, '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': '6382925', 'n_tokens_mistral': 3383, 'n_tokens_neox': 3149, 'n_words': 676}