<commit_before>var Initializer = require('./Initializer');
var Watcher = require('../watcher/Watcher');
var Queue = require('../render/Queue');
var OutputWriter = require('../render/OutputWriter');
var _ = require('lodash');
var _super = Initializer.prototype;

module.exports = Initializer.extend({

  'run': function (next) {

    var self = this;
    var options = self.options;

    var watcher = asimov.watcher = new Watcher(null, options);
    var queue = asimov.queue = new Queue(null, options);
    var output = asimov.writer = new OutputWriter(options);

    var collections = [
      options.pages,
      options.styleSheets,
      options.scripts
    ];

    _.each(collections, function (collection) {

      // self.bindTo(collection, 'add change:raw forced:change', queue.add);
      self.bindTo(collection, 'add change:raw forced:change', collection.markDirty);
      self.bindTo(collection, 'change:rendered', output.write);
      self.bindTo(collection, 'change:rendered', watcher.watch);
      self.bindTo(collection, 'remove', output.clear);
    });

    self.bindTo(options.templates, 'add change:raw', watcher.watch);

    self.options = options;
    next();
  }
});<commit_msg>in production mode, render all pages and things on startup<commit_after>var Initializer = require('./Initializer');
var Watcher = require('../watcher/Watcher');
var Queue = require('../render/Queue');
var OutputWriter = require('../render/OutputWriter');
var _ = require('lodash');
var _super = Initializer.prototype;

module.exports = Initializer.extend({

  'run': function (next) {

    var self = this;
    var options = self.options;

    var watcher = asimov.watcher = new Watcher(null, options);
    var queue = asimov.queue = new Queue(null, options);
    var output = asimov.writer = new OutputWriter(options);

    var collections = [
      options.pages,
      options.styleSheets,
      options.scripts
    ];

    _.each(collections, function (collection) {

      var changeHandler = process.env.ENV === 'production' ? queue.add : collection.markDirty;
      // self.bindTo(collection, 'add change:raw forced:change', queue.add);
      // self.bindTo(collection, 'add change:raw forced:change', collection.markDirty);
      self.bindTo(collection, 'add change:raw forced:change', changeHandler);

      self.bindTo(collection, 'change:rendered', output.write);
      self.bindTo(collection, 'change:rendered', watcher.watch);
      self.bindTo(collection, 'remove', output.clear);
    });

    self.bindTo(options.templates, 'add change:raw', watcher.watch);

    self.options = options;
    next();
  }
});
{'fraction_non_alphanumeric': 0.14580152671755725, 'fraction_numerical': 0.0, 'mean_word_length': 3.7310469314079424, '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': '4211456', 'n_tokens_mistral': 786, 'n_tokens_neox': 762, 'n_words': 178}