<commit_before>module.exports = function(grunt)
{
	grunt.registerMultiTask('manifests', "Concat CreateJS manifests", function(){
		var glob = require("glob"),
			path = require('path'),
			_ = grunt.util._,
			log = grunt.log,
			done = this.async;

		var data = this.data,
			cwd = data.cwd || process.cwd(),
			remove = data.remove || '',
			insert = data.insert || '',
			output = data.output,
			files = data.files,
			manifest = {},
			manifestFiles = [];

		if (!output)
		{
			log.error("output field required by the manifests task");
			done(false);
			return;
		}

		if (!files)
		{
			log.error("files field required by the manifests task");
			done(false);
			return;
		}

		function addManifest(file)
		{
			var str = grunt.file.read(file);
			var token = "lib.properties = ";
			var start = str.indexOf(token);

			// Ignore if we don't have the lib.properities
			if (start === -1) return;

			var properties = str.substring(
				start + token.length, 
				str.search(/\;[\n\t\r]*\/\/ stage content\:/)
			);
			eval("properties = " + properties);
			var assets = properties.manifest;
			_.each(assets, function(asset, i){
				asset.src = insert + asset.src.replace(remove, '');
			});
			manifest[path.basename(file, '.js')] = assets;

			// Add to a single collection of all manifest files
			manifestFiles = manifestFiles.concat(assets);
		}

		_.each(_.isArray(files) ? files : [files], function(file){
			// Regular file include
			if (file.indexOf("*") === -1) 
				addManifest(file);
			// Glob expression with wildcard
			else 
			{
				glob(file, { cwd: cwd, sync: true }, function(er, globFiles) {
					_.each(globFiles, addManifest);
				});
			}
		});

		grunt.file.write(output, JSON.stringify(manifest, null, "\t"));

		// The duplicate assets id, so we don't check the same asset<commit_msg>Check for mp3 and wav files in manifest<commit_after>module.exports = function(grunt)
{
	grunt.registerMultiTask('manifests', "Concat CreateJS manifests", function(){
		var glob = require("glob"),
			path = require('path'),
			_ = grunt.util._,
			log = grunt.log,
			done = this.async;

		var data = this.data,
			cwd = data.cwd || process.cwd(),
			remove = data.remove || '',
			insert = data.insert || '',
			output = data.output,
			files = data.files,
			manifest = {},
			manifestFiles = [];

		if (!output)
		{
			log.error("output field required by the manifests task");
			done(false);
			return;
		}

		if (!files)
		{
			log.error("files field required by the manifests task");
			done(false);
			return;
		}

		function addManifest(file)
		{
			var str = grunt.file.read(file);
			var token = "lib.properties = ";
			var start = str.indexOf(token);

			// Ignore if we don't have the lib.properities
			if (start === -1) return;

			var properties = str.substring(
				start + token.length, 
				str.search(/\;[\n\t\r]*\/\/ stage content\:/)
			);
			eval("properties = " + properties);
			var assets = properties.manifest;
			_.each(assets, function(asset, i){
				// don't include any sound files published with the manifest
				if (asset.src.indexOf('mp3') !== -1 || asset.src.indexOf('.wav') !== -1)
				{

					assets.splice(i, 1);
				}
				else
				{
					asset.src = insert + asset.src.replace(remove, '');
				}
			});
			manifest[path.basename(file, '.js')] = assets;

			// Add to a single collection of all manifest files
			manifestFiles = manifestFiles.concat(assets);
		}

		_.each(_.isArray(files) ? files : [files], function(file){
			// Regular file include
			if (file.indexOf("*") === -1) 
				addManifest(file);
			// Glob expression with wildcard
			else 
			{
				glob(file, { cwd: cwd, sync: true }, function(er, globFiles) {
					_.each(globFiles, addManifest);
				});
			}
		});

		grunt.file.write(output, JSON.stringify(manifest, null, "\t"));

		// The duplicate assets id, so we don't check the same asset
{'fraction_non_alphanumeric': 0.1610235202894805, 'fraction_numerical': 0.0023261824760920135, 'mean_word_length': 2.893360160965795, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7228641', 'n_tokens_mistral': 1550, 'n_tokens_neox': 1260, 'n_words': 323}