<commit_before>/*
 * grunt-build-locale
 * https://github.com/ef-ctx/grunt-build-locale
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

    // see the Grunt documentation for more information regarding task
    // creation: http://gruntjs.com/creating-tasks
    grunt.registerMultiTask('build_locale', 'Grunt task to collect, merge and publish locale files.', function() {
        // Merge task-specific and/or target-specific options with these defaults.
        var options = this.options({
            dest: '.',
            filterLocale: [],
            sufix: ''
        });

        // normalise destination dir
        if (options.dest.charAt(options.dest.length - 1) != '/') {
            options.dest += '/';
        }

        // @todo validate destination dir is writable

        var fileRegexp = /([a-z]{2}(_[A-Z]{2})?)\.locale\.json$/;

        var detectLocale = function(filepath) {
            var match = filepath.match(fileRegexp);
            if (match) {
                return match[1];
            }
        };

        var makeDestinationFilename = function(locale) {
            var parts = [locale];
            if (options.sufix) {
                parts.push(options.sufix);
            }
            parts.push('locale.json');
            return options.dest + parts.join('.');
        };

        var mergeData = function(destObj, srcObj) {<commit_msg>add debug line with options<commit_after>/*
 * grunt-build-locale
 * https://github.com/ef-ctx/grunt-build-locale
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 */

'use strict';

module.exports = function(grunt) {

    // see the Grunt documentation for more information regarding task
    // creation: http://gruntjs.com/creating-tasks
    grunt.registerMultiTask('build_locale', 'Grunt task to collect, merge and publish locale files.', function() {
        // Merge task-specific and/or target-specific options with these defaults.
        var options = this.options({
            dest: '.',
            filterLocale: [],
            sufix: ''
        });

        grunt.log.debug('Options: ', JSON.stringify(options));

        // normalise destination dir
        if (options.dest.charAt(options.dest.length - 1) != '/') {
            options.dest += '/';
        }

        // @todo validate destination dir is writable

        var fileRegexp = /([a-z]{2}(_[A-Z]{2})?)\.locale\.json$/;

        var detectLocale = function(filepath) {
            var match = filepath.match(fileRegexp);
            if (match) {
                return match[1];
            }
        };

        var makeDestinationFilename = function(locale) {
            var parts = [locale];
            if (options.sufix) {
                parts.push(options.sufix);
            }
            parts.push('locale.json');
            return options.dest + parts.join('.');
        };

        var mergeData = function(destObj, srcObj) {
{'fraction_non_alphanumeric': 0.1351170568561873, 'fraction_numerical': 0.005351170568561873, 'mean_word_length': 1.9038834951456312, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4375812', 'n_tokens_mistral': 852, 'n_tokens_neox': 824, 'n_words': 196}