<commit_before>'use strict';
var hapi = require('hapi'),
    matchdep = require('matchdep'),
    async = require('async'),
    colors = require('colors');

colors.setTheme({
    silly: 'rainbow',
    input: 'grey',
    verbose: 'cyan',
    info: 'grey',
    data: 'grey',
    help: 'cyan',
    warn: 'yellow',
    debug: 'blue',
    error: 'red',
    success: 'green',
    highlight: 'cyan'
});

var Installable = {
    startServer: function (config, pkg) {
        // start server with app's config
        var server = hapi.createServer(
            'localhost',
            process.env.PORT || config.server.port || 3000,
            config.server
        );

        // mount routes
        server.route(config.routes);

        var applicationName = pkg.name;

        var plugins = matchdep
            .filter(
                applicationName + '-plugin-*',
                pkg
            )
            .map(function (pluginName) {
                return {
                    plugin: require(process.cwd() + '/node_modules/' + pluginName),
                    name: pluginName.replace(/([a-z_\d]+-){2}/i, ''),
                    fullName: pluginName
                };
            }
        );

        console.log('[Installable] %s plugins found'.info, plugins.length);

        var tasks = [];

        if (plugins.length) {
            var pluginsPath = '/plugins/' || (config.installable && config.installable.pluginsPath);
            console.log('[Installable] Loading plugins under path %s'.info, pluginsPath);
            tasks = plugins.map(function (plugin) {
                return function (callback) {
                    server.pack.register(
                        plugin,
                        {
                            route: {
                                prefix: pluginsPath + plugin.name
                            }
                        },
                        function (err) {
                            if (err) {
                                callback(err);
                            } else {
                                console.log(
                                    ('[Installable] Successfully' +
                                     ' registered plugin %s').info,<commit_msg>fix custom path for plugins<commit_after>'use strict';
var hapi = require('hapi'),
    matchdep = require('matchdep'),
    async = require('async'),
    colors = require('colors');

colors.setTheme({
    silly: 'rainbow',
    input: 'grey',
    verbose: 'cyan',
    info: 'grey',
    data: 'grey',
    help: 'cyan',
    warn: 'yellow',
    debug: 'blue',
    error: 'red',
    success: 'green',
    highlight: 'cyan'
});

var Installable = {
    startServer: function (config, pkg) {
        // start server with app's config
        var server = hapi.createServer(
            'localhost',
            process.env.PORT || config.server.port || 3000,
            config.server
        );

        // mount routes
        server.route(config.routes);

        var applicationName = pkg.name;

        var plugins = matchdep
            .filter(
                applicationName + '-plugin-*',
                pkg
            )
            .map(function (pluginName) {
                return {
                    plugin: require(process.cwd() + '/node_modules/' + pluginName),
                    name: pluginName.replace(/([a-z_\d]+-){2}/i, ''),
                    fullName: pluginName
                };
            }
        );

        console.log('[Installable] %s plugins found'.info, plugins.length);

        var tasks = [];

        if (plugins.length) {
            var pluginsPath = (config.installable && config.installable.pluginsPath) || '/plugins/';
            console.log('[Installable] Loading plugins under path %s'.info, pluginsPath);
            tasks = plugins.map(function (plugin) {
                return function (callback) {
                    server.pack.register(
                        plugin,
                        {
                            route: {
                                prefix: pluginsPath + plugin.name
                            }
                        },
                        function (err) {
                            if (err) {
                                callback(err);
                            } else {
                                console.log(
                                    ('[Installable] Successfully' +
                                     ' registered plugin %s').info,
{'fraction_non_alphanumeric': 0.11832740213523131, 'fraction_numerical': 0.002224199288256228, 'mean_word_length': 1.1904529956161713, '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': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2038080', 'n_tokens_mistral': 1152, 'n_tokens_neox': 1077, 'n_words': 247}