<commit_before>module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            /** changes to the source files trigger a karma retest
             */
            sourceChanged: {
                files: ['jsapp/kobo/**/*.js', 'jsapp/kobo/**/*.coffee', 'jsapp/kobo/**/*.html',
                        'jsapp/xlform_model_view/*.coffee', 'jsapp/xlform_model_view/*.js'],
                options: { livereload: true },
            },

            htmlChanged: {
                options: { livereload: true },
                files: ['dkobo/koboform/templates/jasmine_spec.html'],
            },

            /** changes to the tests trigger a karma retest
             */
            // testsChanged: {
            //     files: [
            //         // do we want to jump to all coffee tests?
            //         'jsapp/test/**/*.js',
            //         'jsapp/test/**/*.coffee'
            //     ],
            //     tasks: ['karma:unit'],
            // },

            /** dkobo_xlform.js is build with and AMD packaging module
             *    and is referenced by python and browser.
             *
             *  Changes in the source directory should rebuild the file, which ends up
             *    eventually triggering 'sourceChanged' as well.
             */
            retestXlform: {
                files: ['jsapp/test/xlform/*.coffee'],
                options: { livereload: true },
            },

            rebuildDkoboXlform: {
                files: ['jsapp/xlform_model_view/**/*.js', 'jsapp/xlform_model_view/**/*.coffee'],
                tasks: ['requirejs:compile_xlform'],
            },

            /** One of the scss files changed, which triggers a rebuild
             *  of the generated css files.
             */
            scssChanged: {
                files: ['jsapp/kobo/stylesheets/**/*.scss'],
                tasks: ['build_css'],
                options: { livereload: false },
            },

            // cssChanged: {
                // files: ['jsapp/kobo.compiled/*.css', '!jsapp/**/*.verbose.css'],
                // tasks: [],
                // options: { livereload: true },
            // },
            livereload: {
              options: { livereload: true },
              files: ['jsapp/kobo.compiled/*.css', '!jsapp/**/*.verbose.css'],
            },
        },
        karma: {
            unit: {
                configFile: 'jsapp/test/configs/karma.conf.js',
                singleRun: true,
                browsers: ['PhantomJS'],
            },
            amd: {
                configFile: 'jsapp/test/configs/karma-amd.conf.js',
                singleRun: true,
                browsers: ['PhantomJS'],
            },
            travis: {
                configFile: 'jsapp/test/configs/karma.conf.js',
                singleRun: true,
                browsers: ['PhantomJS'],
            },
        },

        requirejs: {
            compile_xlform: {
                options: {
                    baseUrl: 'jsapp',
                    // uglify-minimization/optimization--
                    optimize: 'none',
                    stubModules: ['cs'],
                    wrap: true,<commit_msg>Fix "WARN [karma]: Port 9876 in use" in a kludgy way<commit_after>module.exports = function(grunt) {

    grunt.initConfig({
        pkg: grunt.file.readJSON('package.json'),
        watch: {
            /** changes to the source files trigger a karma retest
             */
            sourceChanged: {
                files: ['jsapp/kobo/**/*.js', 'jsapp/kobo/**/*.coffee', 'jsapp/kobo/**/*.html',
                        'jsapp/xlform_model_view/*.coffee', 'jsapp/xlform_model_view/*.js'],
                options: { livereload: true },
            },

            htmlChanged: {
                options: { livereload: true },
                files: ['dkobo/koboform/templates/jasmine_spec.html'],
            },

            /** changes to the tests trigger a karma retest
             */
            // testsChanged: {
            //     files: [
            //         // do we want to jump to all coffee tests?
            //         'jsapp/test/**/*.js',
            //         'jsapp/test/**/*.coffee'
            //     ],
            //     tasks: ['karma:unit'],
            // },

            /** dkobo_xlform.js is build with and AMD packaging module
             *    and is referenced by python and browser.
             *
             *  Changes in the source directory should rebuild the file, which ends up
             *    eventually triggering 'sourceChanged' as well.
             */
            retestXlform: {
                files: ['jsapp/test/xlform/*.coffee'],
                options: { livereload: true },
            },

            rebuildDkoboXlform: {
                files: ['jsapp/xlform_model_view/**/*.js', 'jsapp/xlform_model_view/**/*.coffee'],
                tasks: ['requirejs:compile_xlform'],
            },

            /** One of the scss files changed, which triggers a rebuild
             *  of the generated css files.
             */
            scssChanged: {
                files: ['jsapp/kobo/stylesheets/**/*.scss'],
                tasks: ['build_css'],
                options: { livereload: false },
            },

            // cssChanged: {
                // files: ['jsapp/kobo.compiled/*.css', '!jsapp/**/*.verbose.css'],
                // tasks: [],
                // options: { livereload: true },
            // },
            livereload: {
              options: { livereload: true },
              files: ['jsapp/kobo.compiled/*.css', '!jsapp/**/*.verbose.css'],
            },
        },
        karma: {
            unit: {
                configFile: 'jsapp/test/configs/karma.conf.js',
                singleRun: true,
                browsers: ['PhantomJS'],
            },
            amd: {
                /** It would be better to prevent the second karma server from
                 *  starting altogether, instead of just changing the port,
                 *  but that seems unattainable with multiple configuration files.
                 */
                port: 9877,
                configFile: 'jsapp/test/configs/karma-amd.conf.js',
                singleRun: true,
                browsers: ['PhantomJS'],
            },
        },

        requirejs: {
            compile_xlform: {
                options: {
                    baseUrl: 'jsapp',
                    // uglify-minimization/optimization--
                    optimize: 'none',
                    stubModules: ['cs'],
                    wrap: true,
{'fraction_non_alphanumeric': 0.13125561881929876, 'fraction_numerical': 0.001198681450404555, 'mean_word_length': 1.1546158812136862, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '3542508', 'n_tokens_mistral': 1879, 'n_tokens_neox': 1735, 'n_words': 371}