<commit_before>var env = process.env.CI ? 'continuous' : 'unit';
var utils = require('./lib/utils');
var config = {
  src_path: 'src',
  build_path: 'build',
  components_path: '<%= config.build_path %>/components',
  coverage_path:  'coverage',
  require: 'config/require.js'
};

module.exports = function (grunt) {
  // grunt plugins
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  grunt.loadTasks('lib/tasks');

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

    config: config,

    karma: {
      // options: {
      //   configFile: 'karma.conf.js'
      // },
      unit: {
        configFile: 'lib/karma.source.conf.js',
        browsers: ['Chrome']
      },
      continuous: {
        autoWatch: false,
        singleRun: true
      },
      coverage: {
        autoWatch: false,
        singleRun: true,
        reporters: ['progress', 'coverage'],
        preprocessors: {
          'src/scripts/**/*.js': ['coverage']
        },
        coverageReporter: {
          type: 'html',
          dir: 'coverage/'
        }
      },
    },

    watch: {
      build: {
        options: { livereload: true },
        files: ['<%= config.src_path %>/**/*'],
        tasks: ['build']
      },
      source: {
        options: { livereload: true },
        files: ['<%= config.src_path %>/**/*'],
        tasks: ['env-src']
      },
    },

    connect: {
      build: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          livereload: true,
          middleware: function (connect) {
            return [utils.mountFolder(connect, config.build_path)];
          }
        }
      },
      source: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          livereload: true,
          middleware: function (connect) {
            return [utils.mountFolder(connect, config.build_path), utils.mountFolder(connect, config.src_path)];
          }
        }
      },
      coverage: {
        options: {
          port: 5555,
          // hostname: '0.0.0.0',
          keepalive: true,
          open: true,
          middleware: function (connect) {
            var dir = grunt.file.glob.sync(require('path').resolve(config.coverage_path + '/PhantomJS*'))[0];
            return [utils.mountFolder(connect, dir)];
          }
        }
      },
    },

    clean: {
      source: [
        '<%= config.build_path %>/**/*',
        '!<%= config.components_path %>/**',
        '!<%= config.build_path %>/<%= config.require %>'
      ],
      deps: ['<%= config.components_path %>'],
      coverage: ['<%= config.coverage_path %>'],
      require: ['<%= config.require %>']
    },

    copy: {
      source: {
        files: [{ src: ['**', '!<%= config.require_source %>'], dest: '<%= config.build_path %>', cwd: '<%= config.src_path %>', expand: true }]
      },<commit_msg>fix copy source<commit_after>var env = process.env.CI ? 'continuous' : 'unit';
var utils = require('./lib/utils');
var config = {
  src_path: 'src',
  build_path: 'build',
  components_path: '<%= config.build_path %>/components',
  coverage_path:  'coverage',
  require: 'config/require.js'
};

module.exports = function (grunt) {
  // grunt plugins
  require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
  grunt.loadTasks('lib/tasks');

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

    config: config,

    karma: {
      // options: {
      //   configFile: 'karma.conf.js'
      // },
      unit: {
        configFile: 'lib/karma.source.conf.js',
        browsers: ['Chrome']
      },
      continuous: {
        autoWatch: false,
        singleRun: true
      },
      coverage: {
        autoWatch: false,
        singleRun: true,
        reporters: ['progress', 'coverage'],
        preprocessors: {
          'src/scripts/**/*.js': ['coverage']
        },
        coverageReporter: {
          type: 'html',
          dir: 'coverage/'
        }
      },
    },

    watch: {
      build: {
        options: { livereload: true },
        files: ['<%= config.src_path %>/**/*'],
        tasks: ['build']
      },
      source: {
        options: { livereload: true },
        files: ['<%= config.src_path %>/**/*'],
        tasks: ['env-src']
      },
    },

    connect: {
      build: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          livereload: true,
          middleware: function (connect) {
            return [utils.mountFolder(connect, config.build_path)];
          }
        }
      },
      source: {
        options: {
          port: 9000,
          hostname: '0.0.0.0',
          livereload: true,
          middleware: function (connect) {
            return [utils.mountFolder(connect, config.build_path), utils.mountFolder(connect, config.src_path)];
          }
        }
      },
      coverage: {
        options: {
          port: 5555,
          // hostname: '0.0.0.0',
          keepalive: true,
          open: true,
          middleware: function (connect) {
            var dir = grunt.file.glob.sync(require('path').resolve(config.coverage_path + '/PhantomJS*'))[0];
            return [utils.mountFolder(connect, dir)];
          }
        }
      },
    },

    clean: {
      source: [
        '<%= config.build_path %>/**/*',
        '!<%= config.components_path %>/**',
        '!<%= config.build_path %>/<%= config.require %>'
      ],
      deps: ['<%= config.components_path %>'],
      coverage: ['<%= config.coverage_path %>'],
      require: ['<%= config.require %>']
    },

    copy: {
      source: {
        files: [{ src: ['**', '!<%= config.require %>'], dest: '<%= config.build_path %>', cwd: '<%= config.src_path %>', expand: true }]
      },
{'fraction_non_alphanumeric': 0.1803935225491903, 'fraction_numerical': 0.008706251088281386, 'mean_word_length': 1.828163466272772, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, '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': '168783', 'n_tokens_mistral': 1889, 'n_tokens_neox': 1812, 'n_words': 310}