<commit_before>var router = require('./router');
var viewEngine = require('./view_engine');
var env = require('../config/environments/env');
var assetCompiler = require('./lib/assetCompiler');

exports.dataAdapter = null;


// ===== VIEWS =====

exports.viewConfig =  {
  engineName: 'coffee',
  engine: viewEngine.engine,
  viewDir: env.paths.viewDir,
  publicDir: env.paths.publicDir,
  apiPath:'/api'
};


// ===== ROUTES =====

exports.routes = function() {
  return router.routes();
};


// ===== MIDDLEWARE =====

var createAppInstance = function() {
  return function(req, res, next) {
    var App = require(env.paths.entryPath + "/app");  // moweb/app/app.coffee
    req.rendrApp = new App;
    next();
  };
};


exports.middleware = function() {
  return [ createAppInstance() ];
};


// ===== LIBRARIES =====

/**
  - options
    - logger
    - dataAdapter
*/
exports.initLibs = function(options, callback) {
  if (!options) options = {};

  // pass down stashError and stashPerf to router
  router.init(options);

  exports.dataAdapter = options.dataAdapter;

  if (env.current.assetCompiler && env.current.assetCompiler.enabled) {
    assetCompiler.init(env.current.assetCompiler, options.logger, function(err) {
      if (err) return callback(err);
      assetCompiler.compile(callback);
    });
  } else {
    callback();
  }<commit_msg>don't compile assets at init<commit_after>var router = require('./router');
var viewEngine = require('./view_engine');
var env = require('../config/environments/env');
//var assetCompiler = require('./lib/assetCompiler');

exports.dataAdapter = null;


// ===== VIEWS =====

exports.viewConfig =  {
  engineName: 'coffee',
  engine: viewEngine.engine,
  viewDir: env.paths.viewDir,
  publicDir: env.paths.publicDir,
  apiPath:'/api'
};


// ===== ROUTES =====

exports.routes = function() {
  return router.routes();
};


// ===== MIDDLEWARE =====

var createAppInstance = function() {
  return function(req, res, next) {
    var App = require(env.paths.entryPath + "/app");  // moweb/app/app.coffee
    req.rendrApp = new App;
    next();
  };
};


exports.middleware = function() {
  return [ createAppInstance() ];
};


// ===== LIBRARIES =====

/**
  - options
    - logger
    - dataAdapter
*/
exports.initLibs = function(options, callback) {
  if (!options) options = {};

  // pass down stashError and stashPerf to router
  router.init(options);

  exports.dataAdapter = options.dataAdapter;

  callback();
  // if (env.current.assetCompiler && env.current.assetCompiler.enabled) {
  //   assetCompiler.init(env.current.assetCompiler, options.logger, function(err) {
  //     if (err) return callback(err);
  //     assetCompiler.compile(callback);
  //   });
  // } else {
  //   callback();
  // }
{'fraction_non_alphanumeric': 0.18208197315923105, 'fraction_numerical': 0.0, 'mean_word_length': 3.3917197452229297, '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': '607366', 'n_tokens_mistral': 907, 'n_tokens_neox': 884, 'n_words': 173}