<commit_before>'use strict';
var fs = require('fs'),
    dateFormat = require('dateformat'),
    git = require('../lib/git'),
    path = require('path'),
    util = require('util'),
    semver = require('semver'),
    yeoman = require('yeoman-generator');

var ReleaseNotesGenerator = module.exports = function ReleaseNotesGenerator(args, options, config) {
  yeoman.generators.NamedBase.apply(this, arguments);

  this.option('dry-run', {
    desc: 'Finds the changes that will be recorded and log to the console rather than disk',
    type: 'Boolean'
  });
  this.dryRun = options['dry-run'];

  this.date = dateFormat(new Date(), 'mmmm dS, yyyy');

  if (this.name !== 'major' && this.name !== 'minor' && this.name !== 'patch') {
    throw new Error('"' + this.name + '" must be one of {major, minor, patch}');
  }
};

util.inherits(ReleaseNotesGenerator, yeoman.generators.NamedBase);

ReleaseNotesGenerator.prototype.ensureClean = git.ensureClean;
ReleaseNotesGenerator.prototype.ensureFetched = git.ensureFetched;

ReleaseNotesGenerator.prototype.readVersions = function() {
  var config;
  try {
    config = JSON.parse(fs.readFileSync('bower.json'));
  } catch (err) {
    config = JSON.parse(fs.readFileSync('package.json'));
  }

  this.priorVersion = 'v' + config.version;
  this.version = 'v' + semver.inc(this.priorVersion, this.name);
};

ReleaseNotesGenerator.prototype.loadNotes = function() {
  try {
    this.existing = fs.readFileSync('RELEASE.md');
    this.notesName = 'RELEASE.md';
  } catch (err) {
    try {
      this.existing = fs.readFileSync('release-notes.md');
      this.notesName = 'release-notes.md';
    } catch (err) {
      try {
        this.existing = fs.readFileSync('CHANGELOG.md');
        this.notesName = 'CHANGELOG.md';
      } catch (err) {
        this.notesName = 'release-notes.md';
      }
    }
  }

  if (this.existing) {
    this.existing = this.existing.toString();
    this.firstCommit = this.priorVersion;
  }
};

ReleaseNotesGenerator.prototype.originName = git.originName;
ReleaseNotesGenerator.prototype.findFirstCommit = git.findFirstCommit;
ReleaseNotesGenerator.prototype.commitTime = git.commitTime;
ReleaseNotesGenerator.prototype.findChanges = git.findChanges;
<commit_msg>Update notes version<commit_after>'use strict';
var fs = require('fs'),
    dateFormat = require('dateformat'),
    git = require('../lib/git'),
    path = require('path'),
    util = require('util'),
    semver = require('semver'),
    yeoman = require('yeoman-generator');

var ReleaseNotesGenerator = module.exports = function ReleaseNotesGenerator(args, options, config) {
  yeoman.generators.Base.apply(this, arguments);

  this.date = dateFormat(new Date(), 'mmmm dS, yyyy');

  this.option('dry-run', {
    desc: 'Finds the changes that will be recorded and log to the console rather than disk',
    type: 'Boolean'
  });
  this.dryRun = options['dry-run'];

  if (!this.dryRun) {
    this.argument('increment', {desc: 'Increment type. May be one of {major, minor, patch, prerelease}', required: true});

    if (this.increment !== 'major' && this.increment !== 'minor' && this.increment !== 'patch' && this.increment !== 'prerelease') {
      throw new Error('"' + this.increment + '" must be one of {major, minor, patch, prerelease}');
    }
  }
};

util.inherits(ReleaseNotesGenerator, yeoman.generators.Base);

ReleaseNotesGenerator.prototype.ensureClean = git.ensureClean;
ReleaseNotesGenerator.prototype.ensureFetched = git.ensureFetched;

ReleaseNotesGenerator.prototype.readVersions = function() {
  var config;
  try {
    config = JSON.parse(fs.readFileSync('bower.json'));
  } catch (err) {
    config = JSON.parse(fs.readFileSync('package.json'));
  }

  this.priorVersion = 'v' + config.version;
  this.version = 'v' + semver.inc(this.priorVersion, this.increment || 'patch');
};

ReleaseNotesGenerator.prototype.loadNotes = function() {
  try {
    this.existing = fs.readFileSync('RELEASE.md');
    this.notesName = 'RELEASE.md';
  } catch (err) {
    try {
      this.existing = fs.readFileSync('release-notes.md');
      this.notesName = 'release-notes.md';
    } catch (err) {
      try {
        this.existing = fs.readFileSync('CHANGELOG.md');
        this.notesName = 'CHANGELOG.md';
      } catch (err) {
        this.notesName = 'release-notes.md';
      }
    }
  }

  if (this.existing) {
    this.existing = this.existing.toString();
    this.firstCommit = this.priorVersion;
  }
};

ReleaseNotesGenerator.prototype.originName = git.originName;
ReleaseNotesGenerator.prototype.findFirstCommit = git.findFirstCommit;
ReleaseNotesGenerator.prototype.commitTime = git.commitTime;
ReleaseNotesGenerator.prototype.findChanges = git.findChanges;

{'fraction_non_alphanumeric': 0.151380042462845, 'fraction_numerical': 0.0, 'mean_word_length': 3.8920041536863965, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3165389', 'n_tokens_mistral': 1503, 'n_tokens_neox': 1458, 'n_words': 290}