<commit_before>'use strict';
/**
 * @module gulp-gitflow
 * @class GitflowRegistry
 */
const argv = require('yargs')
  .alias('v', 'version')
  .alias('t', 'type')
  .alias('m', 'message')
  .alias('p', 'push')
  .argv;
const _ = require('lodash');
const semver = require('semver');
const sequence = require('run-sequence');
const util = require('gulp-util');
const GitflowRelease = require('./lib/release');

const DEFAULTS = {
  tasks: {
    release: 'release'
  },
  messages: {
    bump: 'Bump release version',
    next: 'Set next development version'
  }
};

class GitflowRegistry {
  constructor(options) {
    this.options = _.defaults({}, options, DEFAULTS);
  }

  init(taker) {
    let release = new GitflowRelease(this.options);

    taker.task('release:start', (done) => release.start(argv.version, argv.type, done));
    taker.task('release:finish', (done) => release.finish(argv.message, done));
    taker.task('release:push', release.push);
    taker.task('release:commit', () => release.commit(this.options.messages.bump));
    taker.task('release:commit:next', () => release.commit(this.options.messages.next));
    taker.task('bump', () => {
      if (argv.version || argv.type) {
        return release.bump(argv.version, argv.type, argv.message);
      }
      let ver = semver.inc(release.version(), 'patch');
      return release.bump(ver, null, argv.message);
    });
    taker.task('bump:next', () => {
      let ver = semver.inc(release.version(), 'patch');
      return release.bump(ver + '-dev', null, argv.message);
    });

    function done(cb) {
      return () => {
        if (argv.p) {
          util.log(util.colors.cyan('[gulp-release]') +
            ' All done: tags and branches pushed to ' + util.colors.magenta('origin'));
        } else {
          util.log(util.colors.cyan('[gulp-release]') +
            ' All done: review changes and push to ' + util.colors.magenta('origin'));
        }
        return cb();
      };
    }

    let recipes = {
      release: _.compact([
        'release:start',
        'bump',
        'release:commit',
        'release:finish',
        'bump:next',
        'release:commit:next',
        argv.p ? 'release:push' : undefined
      ])
    };

    taker.task(this.options.tasks.release, (cb) => _.spread(sequence)(recipes.release.concat(done(cb))));<commit_msg>Add option to provide a custom dev suffix<commit_after>'use strict';
/**
 * @module gulp-gitflow
 * @class GitflowRegistry
 */
const argv = require('yargs')
  .alias('v', 'version')
  .alias('t', 'type')
  .alias('m', 'message')
  .alias('p', 'push')
  .argv;
const _ = require('lodash');
const semver = require('semver');
const sequence = require('run-sequence');
const util = require('gulp-util');
const GitflowRelease = require('./lib/release');

const DEFAULTS = {
  tasks: {
    release: 'release'
  },
  messages: {
    bump: 'Bump release version',
    next: 'Set next development version'
  }
};

class GitflowRegistry {
  constructor(options) {
    this.options = _.defaults({}, options, DEFAULTS);
  }

  init(taker) {
    let release = new GitflowRelease(this.options);

    taker.task('release:start', (done) => release.start(argv.version, argv.type, done));
    taker.task('release:finish', (done) => release.finish(argv.message, done));
    taker.task('release:push', release.push);
    taker.task('release:commit', () => release.commit(this.options.messages.bump));
    taker.task('release:commit:next', () => release.commit(this.options.messages.next));
    taker.task('bump', () => {
      if (argv.version || argv.type) {
        return release.bump(argv.version, argv.type, argv.message);
      }
      let ver = semver.inc(release.version(), 'patch');
      return release.bump(ver, null, argv.message);
    });
    taker.task('bump:next', () => {
      let ver = semver.inc(release.version(), 'patch');
      let devSuffix = this.options.devSuffix || '-dev';
      return release.bump(ver + devSuffix, null, argv.message);
    });

    function done(cb) {
      return () => {
        if (argv.p) {
          util.log(util.colors.cyan('[gulp-release]') +
            ' All done: tags and branches pushed to ' + util.colors.magenta('origin'));
        } else {
          util.log(util.colors.cyan('[gulp-release]') +
            ' All done: review changes and push to ' + util.colors.magenta('origin'));
        }
        return cb();
      };
    }

    let recipes = {
      release: _.compact([
        'release:start',
        'bump',
        'release:commit',
        'release:finish',
        'bump:next',
        'release:commit:next',
        argv.p ? 'release:push' : undefined
      ])
    };

    taker.task(this.options.tasks.release, (cb) => _.spread(sequence)(recipes.release.concat(done(cb))));
{'fraction_non_alphanumeric': 0.18235170823726682, 'fraction_numerical': 0.0, 'mean_word_length': 2.943801652892562, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '3237348', 'n_tokens_mistral': 1531, 'n_tokens_neox': 1524, 'n_words': 294}