<commit_before>/**
 * grunt-wrap
 * https://github.com/chrissrogers/grunt-wrap
 *
 * Copyright (c) 2012 <NAME>
 * Licensed under the MIT license.
 */

// wrap: {
//   modules: {
//     src: ['assets/*.js'],
//     dest: 'dist/',
//     wrapper: ['define(function (require, exports, module) {\n', '\n});']
//   }
// }

module.exports = function(grunt) {

  // ==========================================================================
  // TASKS
  // ==========================================================================

  grunt.registerMultiTask('wrap', 'Wrap files.', function () {
    var files = grunt.file.expandFiles(this.file.src),
        path = require('path'),
        task = this,
        src;
    // Concat specified files.
    
    if (files) {
      files.map(function (filepath) {
        src = grunt.helper('wrap', filepath, {wrapper: task.data.wrapper, excludeBase: task.data.excludeBase});
        grunt.file.write(path.join(task.file.dest, filepath.replace(task.data.excludeBase, '')), src);
      });
    }

    // Fail task if errors were logged.
    if (this.errorCount) return false;

    // Otherwise, print a success message.
    grunt.log.writeln('Wrapped files created in "' + this.file.dest + '".');
  });

  // ==========================================================================
  // HELPERS
  // ==========================================================================

  grunt.registerHelper('wrap', function (filepath, options) {

    options = grunt.utils._.defaults(options || {}, {
      wrapper: ['', ''],
      excludeBase: ''
    });

    //console.log("Exclude me: " + options.excludeBase);
    definepath = filepath.replace(options.excludeBase, '').replace(/\.\w+$/, '');

    if (typeof(options.wrapper) === 'function') {
      return options.wrapper(definepath, grunt.task.directive(filepath, grunt.file.read));
    } else {
      return options.wrapper[0] + grunt.task.directive(filepath, grunt.file.read) + options.wrapper[1];
    }
    
  });

};<commit_msg>Update to grunt 0.4.x<commit_after>/**
 * grunt-wrap
 * https://github.com/chrissrogers/grunt-wrap
 *
 * Copyright (c) 2012 <NAME>
 * Licensed under the MIT license.
 */

// wrap: {
//   modules: {
//     src: ['assets/*.js'],
//     dest: 'dist/',
//     wrapper: ['define(function (require, exports, module) {\n', '\n});']
//   }
// }

module.exports = function(grunt) {

  // ==========================================================================
  // TASKS
  // ==========================================================================

  grunt.registerMultiTask('wrap', 'Wrap files.', function () {

    var files = this.files[0].src,
        options = this.data;

    //var file = grunt.file.read(this);
    //console.log(files);

    files.map(function(filepath) {
      var file = grunt.file.read(filepath)
      var definepath = filepath.replace(options.excludeBase, '').replace(/\.\w+$/, '');

      var src = 'window.require.define({"' + definepath + '": function(exports, require, module) {\n' + file + '}});\n\n';
      grunt.file.write(filepath, src);
    });
  });

}
{'fraction_non_alphanumeric': 0.3125, 'fraction_numerical': 0.004188144329896907, 'mean_word_length': 3.1621983914209117, 'pattern_counts': {'":': 1, '<': 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': '761516', 'n_tokens_mistral': 964, 'n_tokens_neox': 901, 'n_words': 169}