<commit_before>var semver = require('semver'),
    f = require('util').format,
    jsFiles = [
      'src/js/version.js',
      'src/js/utils.js',
      'src/js/event_target.js',
      'src/js/persistent_storage.js',
      'src/js/request_cache.js',
      'src/js/transport.js',
      'src/js/dataset.js',
      'src/js/input_view.js',
      'src/js/dropdown_view.js',
      'src/js/typeahead_view.js',
      'src/js/typeahead.js'
    ];

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    buildDir: 'dist',

    banner: [
      '/*!',
      ' * typeahead.js <%= pkg.version %>',
      ' * https://github.com/twitter/typeahead',
      ' * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT',
      ' */\n\n'
    ].join('\n'),

    less: {
      css: {
        src: 'src/css/typeahead.css',
        dest: '<%= buildDir %>/typeahead.css'
      },
      cssmin: {
        options: { yuicompress: true },
        src: 'src/css/typeahead.css',
        dest: '<%= buildDir %>/typeahead.min.css'
      }
    },

    concat: {
      css: {
        options: {
          banner: '<%= banner %>',
          stripBanners: true
        },
        src: '<%= less.css.dest %>',
        dest: '<%= less.css.dest %>'
      },
      cssmin: {
        options: {
          banner: '<%= banner %>',
          stripBanners: true
        },
        src: '<%= less.cssmin.dest %>',
        dest: '<%= less.cssmin.dest %>'
      },
      js: {
        src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
        dest: '<%= buildDir %>/typeahead.js'
      },
      jsmin: {
        src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
        dest: '<%= buildDir %>/typeahead.min.js'
      }
    },

    sed: {
      version: {
        pattern: '%VERSION%',
        replacement: '<%= pkg.version %>',
        path: ['<%= concat.js.dest %>', '<%= concat.jsmin.dest %>']
      }
    },

    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      js: {
        options: {
          mangle: false,
          beautify: true,
          compress: false
        },
        src: '<%= concat.js.dest %>',
        dest: '<%= concat.js.dest %>'
      },
      jsmin: {
        options: {
          mangle: true,
          compress: true
        },
        src: '<%= concat.jsmin.dest %>',
        dest: '<%= concat.jsmin.dest %>'
      }
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      src: jsFiles,
      tests: ['test/*.js'],
      gruntfile: ['Gruntfile.js']
    },

    watch: {
      js: {
        files: jsFiles,
        tasks: 'build:js'
      },
      css: {
        files: '<%= less.css.src %>',
        tasks: 'build:css'
      }
    },

    jasmine: {
      js: {
        src: jsFiles,
        options: {
          specs: 'test/*_spec.js',
          helpers: 'test/helpers/*',
          vendor: 'test/vendor/*'
        }
      }
    },

    exec: {
      open_spec_runner: {
        cmd: 'open _SpecRunner.html'
      },
      git_fail_if_dirty: {
        cmd: 'test -z "$(git status --porcelain)"'
      },
      git_add: {
        cmd: 'git add .'
      },
      git_commit: {
        cmd: function(m) { return f('git commit -m "%s"', m); }
      },
      git_tag: {
        cmd: function(v) { return f('git tag v%s -am "%s"', v, v); }
      },
      git_push: {
        cmd: 'git push && git push --tags'
      },
      publish_assets: {
        cmd: [
          'cp -r <%= buildDir %> typeahead.js',
          'zip -r typeahead.js/typeahead.js.zip typeahead.js',
          'git checkout gh-pages',
          'rm -rf releases/latest',
          'cp -r typeahead.js releases/<%= pkg.version %>',
          'cp -r tyepahead.js releases/latest',
          'git add releases/<%= pkg.version %> releases/latest',
          'sed -E -i "" \'s/v[0-9]+\\.[0-9]+\\.[0-9]+/v<%= pkg.version %>/\' index.html',
          'git add index.html',
          'git commit -m "Add assets for <%= pkg.version %>."',
          'git push',
          'git checkout -',
          'rm -rf typeahead.js'
        ].join(' && ')
      }
    },

    clean: {
      dist: 'dist'
    },

    connect: {
      server: {
        options: {
          port: 8888, keepalive: true
        }<commit_msg>Fix release task.<commit_after>var semver = require('semver'),
    f = require('util').format,
    jsFiles = [
      'src/js/version.js',
      'src/js/utils.js',
      'src/js/event_target.js',
      'src/js/persistent_storage.js',
      'src/js/request_cache.js',
      'src/js/transport.js',
      'src/js/dataset.js',
      'src/js/input_view.js',
      'src/js/dropdown_view.js',
      'src/js/typeahead_view.js',
      'src/js/typeahead.js'
    ];

module.exports = function(grunt) {
  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),

    buildDir: 'dist',

    banner: [
      '/*!',
      ' * typeahead.js <%= pkg.version %>',
      ' * https://github.com/twitter/typeahead',
      ' * Copyright 2013 Twitter, Inc. and other contributors; Licensed MIT',
      ' */\n\n'
    ].join('\n'),

    less: {
      css: {
        src: 'src/css/typeahead.css',
        dest: '<%= buildDir %>/typeahead.css'
      },
      cssmin: {
        options: { yuicompress: true },
        src: 'src/css/typeahead.css',
        dest: '<%= buildDir %>/typeahead.min.css'
      }
    },

    concat: {
      css: {
        options: {
          banner: '<%= banner %>',
          stripBanners: true
        },
        src: '<%= less.css.dest %>',
        dest: '<%= less.css.dest %>'
      },
      cssmin: {
        options: {
          banner: '<%= banner %>',
          stripBanners: true
        },
        src: '<%= less.cssmin.dest %>',
        dest: '<%= less.cssmin.dest %>'
      },
      js: {
        src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
        dest: '<%= buildDir %>/typeahead.js'
      },
      jsmin: {
        src: ['src/js/intro.js', jsFiles, 'src/js/outro.js'],
        dest: '<%= buildDir %>/typeahead.min.js'
      }
    },

    sed: {
      version: {
        pattern: '%VERSION%',
        replacement: '<%= pkg.version %>',
        path: ['<%= concat.js.dest %>', '<%= concat.jsmin.dest %>']
      }
    },

    uglify: {
      options: {
        banner: '<%= banner %>'
      },
      js: {
        options: {
          mangle: false,
          beautify: true,
          compress: false
        },
        src: '<%= concat.js.dest %>',
        dest: '<%= concat.js.dest %>'
      },
      jsmin: {
        options: {
          mangle: true,
          compress: true
        },
        src: '<%= concat.jsmin.dest %>',
        dest: '<%= concat.jsmin.dest %>'
      }
    },

    jshint: {
      options: {
        jshintrc: '.jshintrc'
      },
      src: jsFiles,
      tests: ['test/*.js'],
      gruntfile: ['Gruntfile.js']
    },

    watch: {
      js: {
        files: jsFiles,
        tasks: 'build:js'
      },
      css: {
        files: '<%= less.css.src %>',
        tasks: 'build:css'
      }
    },

    jasmine: {
      js: {
        src: jsFiles,
        options: {
          specs: 'test/*_spec.js',
          helpers: 'test/helpers/*',
          vendor: 'test/vendor/*'
        }
      }
    },

    exec: {
      open_spec_runner: {
        cmd: 'open _SpecRunner.html'
      },
      git_fail_if_dirty: {
        cmd: 'test -z "$(git status --porcelain)"'
      },
      git_add: {
        cmd: 'git add .'
      },
      git_commit: {
        cmd: function(m) { return f('git commit -m "%s"', m); }
      },
      git_tag: {
        cmd: function(v) { return f('git tag v%s -am "%s"', v, v); }
      },
      git_push: {
        cmd: 'git push && git push --tags'
      },
      publish_assets: {
        cmd: [
          'cp -r <%= buildDir %> typeahead.js',
          'zip -r typeahead.js/typeahead.js.zip typeahead.js',
          'git checkout gh-pages',
          'rm -rf releases/latest',
          'cp -r typeahead.js releases/<%= pkg.version %>',
          'cp -r typeahead.js releases/latest',
          'git add releases/<%= pkg.version %> releases/latest',
          'sed -E -i "" \'s/v[0-9]+\\.[0-9]+\\.[0-9]+/v<%= pkg.version %>/\' index.html',
          'git add index.html',
          'git commit -m "Add assets for <%= pkg.version %>."',
          'git push',
          'git checkout -',
          'rm -rf typeahead.js'
        ].join(' && ')
      }
    },

    clean: {
      dist: 'dist'
    },

    connect: {
      server: {
        options: {
          port: 8888, keepalive: true
        }
{'fraction_non_alphanumeric': 0.1892556179775281, 'fraction_numerical': 0.0032771535580524347, 'mean_word_length': 1.4898018648018647, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 53, 'https://': 2, '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': '4571293', 'n_tokens_mistral': 3102, 'n_tokens_neox': 2936, 'n_words': 534}