<commit_before>/**
 * Tools for starting Hoodie plugins
 */

var plugins_manager = require('hoodie-plugins-manager/lib/index');
var clc = require('cli-color');
var modulelib = require('module');
var async = require('async');
var path = require('path');
var fs = require('fs');

var configStore = require('./config');


/**
 * Read plugins from package.json and load their metadata into env_config object
 */

exports.load = function (env_config, callback) {
  // read package.json files for plugins and add to env_config object
  env_config.plugins = exports.readPlugins(env_config);
  callback(null, env_config);
};

/**
 * Starts all plugins defined in the project's package.json file
 */

exports.startAll = function (env_config, callback) {
  // get couchdb admin password from configStore.json
  configStore.getCouchCredentials(env_config, function (err, username, password) {
    if (err) {
      return callback(err);
    }

    var pm_configStore = {
      couchdb: {
        url: env_config.couch.url,
        user: username,
        pass: password
      }
    };

    plugins_manager.start(pm_configStore, function (err, manager) {
      if (err) {
        return callback(err);
      }

      // loop through plugins and start
      async.map(Object.keys(env_config.plugins), function (name, cb) {
        var hoodie = manager.createAPI({name: name});
        return exports.startPlugin(name, env_config, hoodie, cb);
      },
      function (err) {
        if (err) {
          return callback(err);
        }
        console.log('All plugins started.');
        callback();
      });<commit_msg>chore(typo): fix typo in comment<commit_after>/**
 * Tools for starting Hoodie plugins
 */

var plugins_manager = require('hoodie-plugins-manager/lib/index');
var clc = require('cli-color');
var modulelib = require('module');
var async = require('async');
var path = require('path');
var fs = require('fs');

var configStore = require('./config');


/**
 * Read plugins from package.json and load their metadata into env_config object
 */

exports.load = function (env_config, callback) {
  // read package.json files for plugins and add to env_config object
  env_config.plugins = exports.readPlugins(env_config);
  callback(null, env_config);
};

/**
 * Starts all plugins defined in the project's package.json file
 */

exports.startAll = function (env_config, callback) {
  // get couchdb admin password from config.json
  configStore.getCouchCredentials(env_config, function (err, username, password) {
    if (err) {
      return callback(err);
    }

    var pm_configStore = {
      couchdb: {
        url: env_config.couch.url,
        user: username,
        pass: password
      }
    };

    plugins_manager.start(pm_configStore, function (err, manager) {
      if (err) {
        return callback(err);
      }

      // loop through plugins and start
      async.map(Object.keys(env_config.plugins), function (name, cb) {
        var hoodie = manager.createAPI({name: name});
        return exports.startPlugin(name, env_config, hoodie, cb);
      },
      function (err) {
        if (err) {
          return callback(err);
        }
        console.log('All plugins started.');
        callback();
      });
{'fraction_non_alphanumeric': 0.1241486068111455, 'fraction_numerical': 0.0, 'mean_word_length': 2.974169741697417, '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': '2714644', 'n_tokens_mistral': 934, 'n_tokens_neox': 929, 'n_words': 262}