<commit_before>var path = require('path'),
    fs = require('fs'),
    requirejs = require('requirejs'),
    _ = require('underscore');

module.exports = function (options, callback) {

    _.defaults(options, {
        config: "config.json",
        html: "index.html",
        serverFactoryClassName: "xaml!web/Server",

        environment: null,
        serverRoot: null,
        documentRoot: null,

        console: {
            log: function () {
            },
            error: function () {
            }
        }
    });

    var serverRoot = options.serverRoot,
        documentRoot = options.documentRoot,
        configPath = options.config,
        serverFactoryClassName = options.serverFactoryClassName,
        serverInstance;

    var serverModule = require(path.join(options.serverRoot, "..", "index.js"));

    if (path.resolve(configPath) !== configPath) {
        configPath = path.join(serverRoot, configPath);
    }

    var config = {},
        parameter = {},
        projectRequire = serverModule.require,
        rappidRequire = require;

    try {
        _.defaults(config, {
            nodeRequire: function () {
                try {
                    return rappidRequire.apply(rappidRequire, arguments);
                } catch (e) {
                    return projectRequire.apply(projectRequire, arguments);
                }
            },
            baseUrl: serverRoot,
            documentRoot: documentRoot,
            serverRoot: serverRoot<commit_msg>fixed server command if no index.js file is defined<commit_after>var path = require('path'),
    fs = require('fs'),
    requirejs = require('requirejs'),
    _ = require('underscore');

module.exports = function (options, callback) {

    _.defaults(options, {
        config: "config.json",
        html: "index.html",
        serverFactoryClassName: "xaml!web/Server",

        environment: null,
        serverRoot: null,
        documentRoot: null,

        console: {
            log: function () {
            },
            error: function () {
            }
        }
    });

    var serverRoot = options.serverRoot,
        documentRoot = options.documentRoot,
        configPath = options.config,
        serverFactoryClassName = options.serverFactoryClassName,
        serverInstance;

    var serverModule;
    try {
        serverModule = require(path.join(options.serverRoot, "..", "index.js"));
    } catch(e){
        console.warn("WARN: No index.js for server module defined. Please add a index.js file in the project directory");
    }

    if (path.resolve(configPath) !== configPath) {
        configPath = path.join(serverRoot, configPath);
    }

    var config = {},
        parameter = {},
        projectRequire = (serverModule ? serverModule.require : null),
        rappidRequire = require;

    try {
        _.defaults(config, {
            nodeRequire: function () {
                try {
                    return rappidRequire.apply(rappidRequire, arguments);
                } catch (e) {
                    return projectRequire.apply(projectRequire, arguments);
                }
            },
            baseUrl: serverRoot,
            documentRoot: documentRoot,
            serverRoot: serverRoot
{'fraction_non_alphanumeric': 0.10974106041923551, 'fraction_numerical': 0.0, 'mean_word_length': 1.9181654676258992, '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': '2833498', 'n_tokens_mistral': 835, 'n_tokens_neox': 806, 'n_words': 180}