<commit_before>/*
 * grunt-version-file
 * https://github.com/cfogelberg/grunt-version-file
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 *
 * Class SRP: Assemble and write JSON version file to disk
 */

function VersionFileWriter() {
}

VersionFileWriter.prototype.write_version_file = function(options) {
  var grunt = require("grunt");

  if(options.json_creator === undefined || typeof(options.json_creator) !== "object") {
    throw new Error("VersionFileWriter.write_version_file requires options.json_creator JsonCreator");
  }
  if(options.out === undefined || typeof(options.out) !== "string") {
    throw new Error("VersionFileWriter.write_version_file requires options.out string");
  }

  grunt.file.write(options.out, options.json_creator.create_json_string());
};

module.exports = VersionFileWriter;<commit_msg>New code structure: VFW choreographs - VFW implementation updated<commit_after>/*
 * grunt-version-file
 * https://github.com/cfogelberg/grunt-version-file
 *
 * Copyright (c) 2014 <NAME>
 * Licensed under the MIT license.
 *
 * Class SRP: Assemble and write JSON version file to disk
 */

function VersionFileWriter(options) {
  var check_valid_output_creator = function() {
    if(options.output_creator === undefined || typeof(options.output_creator) !== "object") {
      throw new Error("VersionFileWriter requires options.output_creator to be an object");
    }
  };

  var check_valid_generator_manager = function() {
    if(options.generator_manager === undefined || typeof(options.generator_manager) !== "object") {
      throw new Error("VersionFileWriter requires options.generator_manager to be an object");
    }
  };

  var check_valid_out = function() {
    if(options.out === undefined || typeof(options.out) !== "string") {
      throw new Error("VersionFileWriter requires options.out to be a string");
    }
  };

  var check_valid_async_done = function() {
    if(options.async_done === undefined || typeof(options.async_done) !== "function") {
      throw new Error("VersionFileWriter requires options.async_done to be a function");
    }
  };

  check_valid_output_creator(options.output_creator);
  check_valid_generator_manager(options.generator_manager);
  check_valid_out(options.out);
  check_valid_async_done(options.async_done);

  this.output_creator = options.output_creator;
  this.generator_manager = options.generator_manager;
  this.out = options.out;
  this.async_done = options.async_done;
}

VersionFileWriter.prototype.write_version_file = function() {
  var grunt = require("grunt");
  var object_store = this.generator_manager.generate();
  var output_string = this.output_creator.create_string(object_store);
  grunt.file.write(this.out, output_string);
  this.async_done();
};

module.exports = VersionFileWriter;
{'fraction_non_alphanumeric': 0.12125534950071326, 'fraction_numerical': 0.0028530670470756064, 'mean_word_length': 4.880503144654088, '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': '3713315', 'n_tokens_mistral': 845, 'n_tokens_neox': 824, 'n_words': 175}