<commit_before>var async = require('async');
var Entry = require('entry');
var client = require('client');
var Blog = require('blog');

var dependentsKey = Entry.key.dependents;

// The purpose of this module is to rebuild any
// entries already in the user's folder which depend
// on the contents of this particular file which was
// just changed or removed.

module.exports = function (blogID, path, callback) {

  Blog.get({id: blogID}, function(err, blog){

    client.SMEMBERS(dependentsKey(blogID, path), function(err, dependent_paths){

      if (err) return callback(err);
      
      async.eachSeries(dependent_paths, function(dependent_path, next){

        Entry.build(blog, dependent_path, function(err, updated_dependent){

          if (err) {
            console.log('Error rebuilding dependents:', path, err);
            return next();
          }

          Entry.set(blogID, dependent_path, updated_dependent, function(err){

            if (err) return callback(err);

            next();

          }, false);
        });
      }, callback);
    });
  });
};<commit_msg>Fixed reference to build in rebuild<commit_after>var async = require("async");
var build = require("../../build");
var Entry = require("entry");
var client = require("client");
var Blog = require("blog");

var dependentsKey = Entry.key.dependents;

// The purpose of this module is to rebuild any
// entries already in the user's folder which depend
// on the contents of this particular file which was
// just changed or removed.

module.exports = function(blogID, path, callback) {
  Blog.get({ id: blogID }, function(err, blog) {
    client.SMEMBERS(dependentsKey(blogID, path), function(
      err,
      dependent_paths
    ) {
      if (err) return callback(err);

      async.eachSeries(
        dependent_paths,
        function(dependent_path, next) {
          build(blog, dependent_path, function(err, updated_dependent) {
            if (err) {
              console.log("Error rebuilding dependents:", path, err);
              return next();
            }

            Entry.set(
              blogID,
              dependent_path,
              updated_dependent,
              function(err) {
                if (err) return callback(err);

                next();
              },
              false
            );
          });
        },
        callback
      );
    });
  });
};

{'fraction_non_alphanumeric': 0.12071846282372597, 'fraction_numerical': 0.0, 'mean_word_length': 2.294360385144429, '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': '5983911', 'n_tokens_mistral': 649, 'n_tokens_neox': 627, 'n_words': 189}