<commit_before>var releaseTools = require('./lib/main');
var Step = require('step');

// Customize example files to document via docco
releaseTools.setOptions({
  examplePaths: [
    'Jakefile.js'
  ]
});

// ## Tests task
// This task executes the package tests by calling the standard `npm test` command
desc("execute tests");
task("test",function() {
  var spawn = require('child_process').spawn;
  var child = spawn('npm', ['test']);
  
  console.log('executing the tests...');
  
  child.stderr.on('data', function(stderr) {
    process.stderr.write(stderr);
  });
  child.stdout.on('data', function(stdout) {
    process.stdout.write(stdout);
  });
  child.on('exit', function(code) {
    if (code !== 0) {
      fail(code);
    } else {
      console.log('Done!');
      complete();
    }
  });
}, true);

// Namespace with all the release related tasks
namespace('release', function() {
  desc('Modify the working copy with all the release information');
  task('build', ['test'], function(releaseType) {
    
    Step(
      function(){
        
        // ### Update Changelog
        // It updated the `History.md` file with all the commit messages since
        // last package release (detected by last created tag).
        console.log('Updating History.md file...');
        releaseTools.updateChangelog(this);
      },
      function(err){
        if (err) throw err;
        
        // ### Update Contributors
        // It overwrites the AUTHORS file with all the GIT commiters 
        console.log('Updating AUTHORS file...');
        releaseTools.updateAuthorsFile(this);
      },
      function(err){
        if (err) throw err;

        // ### Create examples
        // It converts all the specified example files to
        // HTML files with inline annotated comments, using 
        // [Docco](http://jashkenas.github.com/docco/)
        console.log('creating examples documentation...');
        releaseTools.createExamples(this);
      },
      function(err) {
        if (err) fail();
        else complete();
      }
    );
  }, true);
  
  desc('Create the public site');
  task('site', function(releaseType) {
    // ### Create site
    // It creates the `docs/` folder with the following contents:
    // * All the assets in `site/javascripts` and `site/stylesheets`
    // * The `site/index.html` skeleton file with the contents of the
    //   specified markdown files
    console.log('Creating the public site page...');
    releaseTools.createSite(function(err){
      if (err) fail();
      else complete();
    });
  }, true);

  desc('Publish to GitHub and NPM the new version');
  task('publish', ['test'] ,function() {
    
    Step(
      function() {
        // First of all check if the `History.md` is modified
        // (to ensure that the `release:build` task has been already executed)
        releaseTools.isWorkingCopyClean('History.md', this);
      },
      function(err, result) {
        if (err) throw('Error while checking if the git tree is clean: ' + err);
        if (result) throw('You must run jake release:build before publish');
        
        // ### Commit to Git
        // Makes the commit and creates the tag
        console.log('Bumping version and creating git tag...');
        releaseTools.commitToGit(this);
      },
      function(err) {
        if (err) throw err;
        
        // ### Update gh-pages branch
        // If the branch does not exist, it creates it with the contents of
        // the `docs/` folder. If it already exists it copies the new contents
        // of the `docs/` folder into the branch
        console.log('Merging changes into gh-pages branch...');
        releaseTools.updatePagesBranch(this);
      },
      function(err) {
        if (err) throw err;
        
        // ### Push to GitHub
        // It just does a `git push origin`
        console.log('Pushing changes to GitHub...');
        releaseTools.pushToGit(this);
      },
      function(err) {
        if (err) throw err;
      
        // ### Publish to NPM
        // The same as `npm publish`
        console.log('Publishing NPM package...');
        releaseTools.npmPublish(this);
      },<commit_msg>Updated the annotated documentation in Jakefile<commit_after>var releaseTools = require('./lib/main');
var Step = require('step');

// This Jakefile exposes the following tasks using the `releasetools` package:
//
//    
//     jake release:bump      # Bump version in package.json
//     jake release:build     # Build the new package version
//     jake release:site      # Create the public site  
//     jake release:publish   # Publish to GitHub and NPM
//    
// * **release:bump** method only increases the version number in the package.json
//
// * **release:build** updates the changelog, the contributors files and creates the
// annotated examples HTML files
//
// * **release:site** updates the package public site, with the new version information
//
// * **release:publish** commits everything to git, creates the git release tag, pushes to
// GitHub and publishes the package to NPM

// Customize example files to document via docco
releaseTools.setOptions({
  examplePaths: [
    'Jakefile.js'
  ]
});

// ## Test task
// This task executes the package tests by calling the standard `npm test` command
desc("execute tests");
task("test",function() {
  var spawn = require('child_process').spawn;
  var child = spawn('npm', ['test']);
  
  console.log('executing the tests...');
  
  child.stderr.on('data', function(stderr) {
    process.stderr.write(stderr);
  });
  child.stdout.on('data', function(stdout) {
    process.stdout.write(stdout);
  });
  child.on('exit', function(code) {
    if (code !== 0) {
      fail(code);
    } else {
      console.log('Done!');
      complete();
    }
  });
}, true);

// Namespace with all the release related tasks
namespace('release', function() {

  // ## Build task
  desc('Modify the working copy with all the release information');
  task('build', ['test'], function(releaseType) {
    Step(
      
      // ### Update Changelog
      // It updated the `History.md` file with all the commit messages since
      // last package release (detected by last created tag).
      function() {
        console.log('Updating History.md file...');
        releaseTools.updateChangelog(this);
      },
      
      // ### Update Contributors
      // It overwrites the AUTHORS file with all the GIT commiters
      function(err) {
        if (err) throw err;
        console.log('Updating AUTHORS file...');
        releaseTools.updateAuthorsFile(this);
      },

      // ### Create examples
      // It converts all the specified example files to
      // HTML files with inline annotated comments, using 
      // [Docco](http://jashkenas.github.com/docco/)
      function(err) {
        if (err) throw err;
        console.log('creating examples documentation...');
        releaseTools.createExamples(this);
      },
      function(err) {
        if (err) fail();
        else complete();
      }
    );
  }, true);
  
  // ## Create site task
  desc('Create the public site');
  task('site', function(releaseType) {
    // ### Create site
    // It creates the `docs/` folder with the following contents:
    // * All the assets in `site/javascripts` and `site/stylesheets`
    // * The `site/index.html` skeleton file with the contents of the
    //   specified markdown files
    console.log('Creating the public site page...');
    releaseTools.createSite(function(err) {
      if (err) fail();
      else complete();
    });
  }, true);

  // ## Publish task
  desc('Publish to GitHub and NPM the new version');
  task('publish', ['test'] ,function() {
    Step(
      
      // Check if the `History.md` is modified
      // (to ensure that the `release:build` task has been already executed)
      function() {
        releaseTools.isWorkingCopyClean('History.md', this);
      },
      
      // ### Commit to Git
      // Makes the commit and creates the tag
      function(err, result) {
        if (err) throw('Error while checking if the git tree is clean: ' + err);
        if (result) throw('You must run jake release:build before publish');
        console.log('Bumping version and creating git tag...');
        releaseTools.commitToGit(this);
      },
      
      // ### Update gh-pages branch
      // If the branch does not exist, it creates it with the contents of
      // the `docs/` folder. If it already exists it copies the new contents
      // of the `docs/` folder into the branch
      function(err) {
        if (err) throw err;
        console.log('Merging changes into gh-pages branch...');
        releaseTools.updatePagesBranch(this);
      },
      
      // ### Push to GitHub
      // It just does a `git push origin`
      function(err) {
        if (err) throw err;
        console.log('Pushing changes to GitHub...');
        releaseTools.pushToGit(this);
      },
      
      // ### Publish to NPM
      // The same as `npm publish`
      function(err) {
        if (err) throw err;
        console.log('Publishing NPM package...');
        releaseTools.npmPublish(this);
      },
{'fraction_non_alphanumeric': 0.13153585853072808, 'fraction_numerical': 0.00021831677764436196, 'mean_word_length': 2.3572737266397947, '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': '1111528', 'n_tokens_mistral': 2566, 'n_tokens_neox': 2518, 'n_words': 835}