<commit_before>'use strict';

var fs = require('fs');
var sh = require('execSync');
var AWS = require('aws-sdk');

module.exports = function(grunt) {
	grunt.registerTask('upload_builds_to_s3', function() {
		var done = this.async();
		var hash = sh.exec('git rev-parse HEAD').stdout.trim();
		var debugBuild = fs.readFileSync('./dist/ember-graph.js', { encoding: 'utf8' });
		var productionBuild = fs.readFileSync('./dist/ember-graph.prod.js', { encoding: 'utf8' });
		var minifiedBuild = fs.readFileSync('./dist/ember-graph.min.js', { encoding: 'utf8' });

		var count = 0;
		var counter = function(success, fileName) {
			count = count + 1;

			if (!success) {
				console.log('Error uploading file to S3: ' + fileName);
			}

			if (count >= 6) {
				done();
			}
		};

		var s3 = new AWS.S3();
		uploadFile(s3, 'ember-graph-latest.js', debugBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.js', debugBuild, counter);
		uploadFile(s3, 'ember-graph-latest.prod.js', productionBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.prod.js', productionBuild, counter);
		uploadFile(s3, 'ember-graph-latest.min.js', minifiedBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.min.js', minifiedBuild, counter);
	});
};

function uploadFile(s3, fileName, contents, callback) {
	s3.putObject({
		Bucket: 'ember-graph-builds',
		Key: fileName,
		Body: contents
	}, function(err, data) {
		callback(!err, fileName);
	});
}<commit_msg>Updated metadata for uploaded builds.<commit_after>'use strict';

var fs = require('fs');
var sh = require('execSync');
var AWS = require('aws-sdk');

module.exports = function(grunt) {
	grunt.registerTask('upload_builds_to_s3', function() {
		var done = this.async();
		var hash = sh.exec('git rev-parse HEAD').stdout.trim();
		var debugBuild = fs.readFileSync('./dist/ember-graph.js', { encoding: 'utf8' });
		var productionBuild = fs.readFileSync('./dist/ember-graph.prod.js', { encoding: 'utf8' });
		var minifiedBuild = fs.readFileSync('./dist/ember-graph.min.js', { encoding: 'utf8' });

		var count = 0;
		var counter = function(success, fileName) {
			count = count + 1;

			if (!success) {
				console.log('Error uploading file to S3: ' + fileName);
			}

			if (count >= 6) {
				done();
			}
		};

		var s3 = new AWS.S3();
		uploadFile(s3, 'ember-graph-latest.js', debugBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.js', debugBuild, counter);
		uploadFile(s3, 'ember-graph-latest.prod.js', productionBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.prod.js', productionBuild, counter);
		uploadFile(s3, 'ember-graph-latest.min.js', minifiedBuild, counter);
		uploadFile(s3, 'ember-graph-' + hash + '.min.js', minifiedBuild, counter);
	});
};

function uploadFile(s3, fileName, contents, callback) {
	s3.putObject({
		ACL: 'public-read',
		Body: contents,
		Bucket: 'ember-graph-builds',
		ContentType: 'application/javascript',
		Key: fileName
	}, function(err, data) {
		callback(!err, fileName);
	});
}
{'fraction_non_alphanumeric': 0.18409622452388907, 'fraction_numerical': 0.012028065486134313, 'mean_word_length': 4.179930795847751, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '748910', 'n_tokens_mistral': 1116, 'n_tokens_neox': 1027, 'n_words': 228}