<commit_before>var semver = require('semver');

module.exports = function (grunt){

  // Project configuration.
  grunt.initConfig({
    pkg                : grunt.file.readJSON('package.json'),
    clean              : {
      dist         : {
        src: ['dist/*']
      },
      opera        : {
        src: ['build/opera/*']
      },
      chrome       : {
        src: ['build/chrome/*']
      },
      firefox      : {
        src: ['build/firefox/*']
      },
      firefox_after: {
        src: ['build/firefox/data/common/dist/popup.comb.js', 'build/firefox/data/common/dist/popup.comb.js.map']
      }
    },
    watch              : {
      dist: {
        files  : ['templates/**', 'common/**', 'firefox/**', 'chrome/**', 'opera/**'],
        tasks  : ['firefox', 'chrome', 'opera'],
        options: {
          nospawn: true
        }
      }
    },
    version            : {
      manifests: {
        src: ['chrome/manifest.json', 'firefox/package.json', 'opera/manifest.json']
      }
    },
    concat             : {
      options : {
        sourceMap: true,
        separator: '\r\n'
      },
      popupjs : {
        src : [
          "common/lib/onerror.js",
          "common/lib/utils.js",
          "common/lib/3rd/jquery.js",
          "common/lib/3rd/jquery.visible.js",
          "common/lib/3rd/baron.js",
          "common/lib/3rd/bootstrap.js",
          "common/lib/3rd/underscore.js",
          "common/lib/3rd/backbone.js",
          "common/lib/3rd/handlebars.js",
          "common/lib/3rd/prettydate.js",
          "common/lib/3rd/i18n.js",
          "common/dist/templates.js",
          "common/lib/handlebars-helpers.js",
          "common/lib/popup.js",
          "common/lib/routes.js",
          "common/lib/init.js"
        ],
        dest: "common/dist/popup.comb.js"
      },
      popupcss: {
        src : [
          "common/css/reset.css",
          "common/css/bootstrap.min.css",
          "common/css/basic.css",
          "common/css/simple-view.css",
          "common/css/white-view.css",
          "common/css/stream-view.css",
          "common/css/game-view.css",
          "common/css/settings-view.css",
          "common/css/menu-view.css",
          "common/css/info-view.css",
          "common/css/fontello.css",
          "common/css/rtl.css",
          "common/css/baron.css"
        ],
        dest: 'common/dist/popup.comb.css'
      }
    },
    copy               : {
      firefox: {
        files: [
          {
            expand: true,
            src   : ['oauth2.js'],
            cwd   : 'common/lib',
            dest  : 'build/firefox/lib'
          },
          {
            expand: true,
            src   : ['common/**'],
            dest  : 'build/firefox/data'
          },
          {
            expand: true,
            src   : ['firefox/**'],
            dest  : 'build/'
          }
        ]
      },
      opera  : {
        files: [
          {
            expand: true,
            src   : ['**'],
            cwd   : 'build/chrome',
            dest  : 'build/opera'
          },
          {
            expand: true,
            src   : ['opera/**'],
            dest  : 'build/'
          }
        ]
      },
      chrome : {
        files: [
          {
            expand: true,
            src   : ['common/**', '_locales/**'],
            dest  : 'build/chrome'
          },
          {
            expand: true,
            src   : ['chrome/**'],
            dest  : 'build/'
          }
        ]
      }
    },
    handlebars         : {
      compile: {
        options: {
          namespace  : 'Handlebars.templates',
          wrapped    : true,
          processName: function (filename){
            return filename.split('/').pop();
          }
        },

        files: {
          'common/dist/templates.js': 'templates/*'
        }
      }
    },
    compress           : {
      opera : {
        options: {
          mode   : 'zip',
          archive: 'dist/twitch-now-opera-<%= pkg.version %>.crx'
        },
        files  : [
          {
            src   : ['**'],
            cwd   : 'build/opera/',
            expand: true
          }
        ]
      },
      chrome: {
        options: {
          mode   : 'zip',
          archive: 'dist/twitch-now-chrome-<%= pkg.version %>.zip'
        },
        files  : [
          {
            src   : ['**'],
            cwd   : 'build/chrome/',
            expand: true
          }
        ]
      }
    },
    'mozilla-addon-sdk': {
      '1_16': {
        options: {
          revision: '1.16'
        }
      },
      '1_17': {
        options: {
          revision: '1.17'
        }
      }
    },
    'mozilla-cfx'      : {
      'run_stable': {
        options: {
          'mozilla-addon-sdk': '1_17',
          extension_dir      : 'build/firefox',
          command            : 'run'
        }
      }
    },
    'mozilla-cfx-xpi'  : {
      stable: {
        options: {
          'mozilla-addon-sdk': '1_17',
          extension_dir      : 'build/firefox',
          dist_dir           : 'dist/',
          arguments          : '--output-file=twitch-now-firefox-<%= pkg.version %>.xpi'
        }
      }
    },
    gittag             : {
      bump: {
        options: {
          tag: '<%= pkg.version %>'
        }
      }
    }
  });

  grunt.registerTask('i18n', function (){
    var locales = {};
    grunt.file.recurse('_locales', function (abspath, rootdir, subdir, filename){
      if ( filename == 'messages.json' ) {<commit_msg>pop out some messages<commit_after>var semver = require('semver');

module.exports = function (grunt){

  // Project configuration.
  grunt.initConfig({
    pkg                : grunt.file.readJSON('package.json'),
    clean              : {
      dist         : {
        src: ['dist/*']
      },
      opera        : {
        src: ['build/opera/*']
      },
      chrome       : {
        src: ['build/chrome/*']
      },
      firefox      : {
        src: ['build/firefox/*']
      },
      firefox_after: {
        src: ['build/firefox/data/common/dist/popup.comb.js', 'build/firefox/data/common/dist/popup.comb.js.map']
      }
    },
    watch              : {
      dist: {
        files  : ['templates/**', 'common/**', 'firefox/**', 'chrome/**', 'opera/**'],
        tasks  : ['firefox', 'chrome', 'opera'],
        options: {
          nospawn: true
        }
      }
    },
    version            : {
      manifests: {
        src: ['chrome/manifest.json', 'firefox/package.json', 'opera/manifest.json']
      }
    },
    concat             : {
      options : {
        sourceMap: true,
        separator: '\r\n'
      },
      popupjs : {
        src : [
          "common/lib/onerror.js",
          "common/lib/utils.js",
          "common/lib/3rd/jquery.js",
          "common/lib/3rd/jquery.visible.js",
          "common/lib/3rd/baron.js",
          "common/lib/3rd/bootstrap.js",
          "common/lib/3rd/underscore.js",
          "common/lib/3rd/backbone.js",
          "common/lib/3rd/handlebars.js",
          "common/lib/3rd/prettydate.js",
          "common/lib/3rd/i18n.js",
          "common/dist/templates.js",
          "common/lib/handlebars-helpers.js",
          "common/lib/popup.js",
          "common/lib/routes.js",
          "common/lib/init.js"
        ],
        dest: "common/dist/popup.comb.js"
      },
      popupcss: {
        src : [
          "common/css/reset.css",
          "common/css/bootstrap.min.css",
          "common/css/basic.css",
          "common/css/simple-view.css",
          "common/css/white-view.css",
          "common/css/stream-view.css",
          "common/css/game-view.css",
          "common/css/settings-view.css",
          "common/css/menu-view.css",
          "common/css/info-view.css",
          "common/css/fontello.css",
          "common/css/rtl.css",
          "common/css/baron.css"
        ],
        dest: 'common/dist/popup.comb.css'
      }
    },
    copy               : {
      firefox: {
        files: [
          {
            expand: true,
            src   : ['oauth2.js'],
            cwd   : 'common/lib',
            dest  : 'build/firefox/lib'
          },
          {
            expand: true,
            src   : ['common/**'],
            dest  : 'build/firefox/data'
          },
          {
            expand: true,
            src   : ['firefox/**'],
            dest  : 'build/'
          }
        ]
      },
      opera  : {
        files: [
          {
            expand: true,
            src   : ['**'],
            cwd   : 'build/chrome',
            dest  : 'build/opera'
          },
          {
            expand: true,
            src   : ['opera/**'],
            dest  : 'build/'
          }
        ]
      },
      chrome : {
        files: [
          {
            expand: true,
            src   : ['common/**', '_locales/**'],
            dest  : 'build/chrome'
          },
          {
            expand: true,
            src   : ['chrome/**'],
            dest  : 'build/'
          }
        ]
      }
    },
    handlebars         : {
      compile: {
        options: {
          namespace  : 'Handlebars.templates',
          wrapped    : true,
          processName: function (filename){
            return filename.split('/').pop();
          }
        },

        files: {
          'common/dist/templates.js': 'templates/*'
        }
      }
    },
    compress           : {
      opera : {
        options: {
          mode   : 'zip',
          archive: 'dist/twitch-now-opera-<%= pkg.version %>.crx'
        },
        files  : [
          {
            src   : ['**'],
            cwd   : 'build/opera/',
            expand: true
          }
        ]
      },
      chrome: {
        options: {
          mode   : 'zip',
          archive: 'dist/twitch-now-chrome-<%= pkg.version %>.zip'
        },
        files  : [
          {
            src   : ['**'],
            cwd   : 'build/chrome/',
            expand: true
          }
        ]
      }
    },
    'mozilla-addon-sdk': {
      '1_16': {
        options: {
          revision: '1.16'
        }
      },
      '1_17': {
        options: {
          revision: '1.17'
        }
      }
    },
    'mozilla-cfx'      : {
      'run_stable': {
        options: {
          'mozilla-addon-sdk': '1_17',
          pipe_output        : true,
          extension_dir      : 'build/firefox',
          command            : 'run'
        }
      }
    },
    'mozilla-cfx-xpi'  : {
      stable: {
        options: {
          'mozilla-addon-sdk': '1_17',
          extension_dir      : 'build/firefox',
          dist_dir           : 'dist/',
          arguments          : '--output-file=twitch-now-firefox-<%= pkg.version %>.xpi'
        }
      }
    },
    gittag             : {
      bump: {
        options: {
          tag: '<%= pkg.version %>'
        }
      }
    }
  });

  grunt.registerTask('i18n', function (){
    var locales = {};
    grunt.file.recurse('_locales', function (abspath, rootdir, subdir, filename){
      if ( filename == 'messages.json' ) {
{'fraction_non_alphanumeric': 0.16058394160583941, 'fraction_numerical': 0.005767324502117689, 'mean_word_length': 1.0884456153556643, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '5058288', 'n_tokens_mistral': 3529, 'n_tokens_neox': 3480, 'n_words': 481}