<commit_before>module.exports = function(grunt) {

  var wintersmith = require("wintersmith");

  grunt.registerMultiTask("wintersmith", "Use the wintersmith static site generator", function () {
    var options = this.options({
        // create the sites environment, can also be called with a config object. e.g.
        // {contents: '/some/contents', locals: {powerLevel: 10}}, ..}
        config: "./config.json"
      }),
      done = this.async();

    // build site
    grunt.helper("wintersmith", options, function (error) {
      if (error) { throw error; }
      done();
    });

  });

  grunt.registerHelper("wintersmith", function (options, callback) {
    // create the sites environment, can also be called with a config object. e.g.
    // {contents: '/some/contents', locals: {powerLevel: 10}}, ..}
    var env = wintersmith(options.config);
    // build site
    env.build(callback);
  });

};<commit_msg>Rewriting functionality to allow for Wintersmith 2.0.5 support and also to allow for optionally setting config file per action<commit_after>var wintersmith = require("wintersmith");

module.exports = function(grunt) {

  var done = {};

  var callback = function(error) {
    if(error) {
      throw error;
    }
    if(done) {
      done();
    }
  };

  grunt.registerMultiTask("wintersmith", "Use the wintersmith static site generator", function () {

    var options = this.options();
    grunt.verbose.writeflags(options, 'Options');
    var _ = grunt.util._;

    options = _.defaults(options, {
      action: 'build',
      config: './config.json'
    });

    done = this.async();

    var env = wintersmith(options.config);

    if(options.action == 'build') {
      env.build(callback);
    } else if(options.action == 'preview') {
      env.preview(callback);
    } else {
      grunt.log.error('Action not supported.  May be build or preview.');
      done(false);
    }

  });

};
{'fraction_non_alphanumeric': 0.145985401459854, 'fraction_numerical': 0.0036496350364963502, 'mean_word_length': 2.8456913827655312, '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': '7351258', 'n_tokens_mistral': 598, 'n_tokens_neox': 564, 'n_words': 153}