<commit_before>/*global exports, require, console, process, __dirname*/

var fs = require('fs'),
    path = require('path'),
    Seq = require('seq'),
    shelljs = require('shelljs'),
    which = shelljs.which,
    env = process.env;

function lkScriptDir(dirInRoot) {
    return path.normalize(env.LK_SCRIPTS_ROOT + dirInRoot);
}

function set(varName, choices, options) {
    var isValid = options && options.notFs ? function(c) { return !!c; } : fs.existsSync;
    choices.unshift(env[varName]); // already set?
    for (var i = 0; i < choices.length; i++) {
	    if (isValid(choices[i])) { return env[varName] = choices[i]; }
    }
    return env[varName] = options && options.useLastIfNothingIsValid ? choices.pop() : undefined;
}

/*
 * general stuff
 */
set("LK_SCRIPTS_ROOT", [path.normalize(__dirname + '/..')]);
set("LK_SCRIPTS_DIR",  [lkScriptDir("/scripts")]);
set("NODE_BIN",		   [which('node'), shelljs.which('node.exe')]);
set("NODEMODULES",	   [lkScriptDir("/node_modules")]);
set("NODEUNIT",		   [env.NODEMODULES + "/nodeunit/bin/nodeunit", which('nodeunit')]);
set("NODEMON",		   [env.NODEMODULES + "/nodemon/nodemon.js"], which('nodemon'));
set("FOREVER",		   [env.NODEMODULES + "/forever/bin/forever", which('forever')]);

/*
 * server related stuff
 * life_star will use miniserver settings
 */
set("MINISERVER_DIR",      [env.LK_SCRIPTS_ROOT + "/minimal_server"]);
set("MINISERVER_PORT",     [9001], {notFs: true});
set("MINISERVER",          [env.MINISERVER_DIR + "/serve.js"]);
set("MINISERVER_HOST",     ["localhost"], {notFs: true});
set("LIFE_STAR_DIR",       [env.LK_SCRIPTS_ROOT + "/life_star"]);
set("LIFE_STAR",           [env.LIFE_STAR_DIR + "/serve.js"]);
// replace with "notesting" to disable test runner interface on server
set("LIFE_STAR_TESTING",   ["testing"], {notFs: true});
// be very chatty about what is going on
set("LIFE_STAR_LOG_LEVEL", ["debug"], {notFs: true});

/*
 * tests
 */
set("MINISERVER_TEST_FILES", [env.MINISERVER_DIR + '/*_test.js'], {notFs: true});
set("LK_TEST_SCRIPT_DIR",    [env.LK_SCRIPTS_DIR + '/testing']);
set("LK_TEST_STARTER",       [env.LK_TEST_SCRIPT_DIR + '/lively_test.js']);
set("LK_TEST_WORLD",         ["run_tests.xhtml"], {notFs: true});
set("LK_TEST_WORLD_SCRIPT",  ["run_tests.js"], {notFs: true});
set("LK_TEST_BROWSER",       ["chrome"], {notFs: true});
set("LK_TEST_TIMEOUT",       [300], {notFs: true});
set("LK_TEST_NOTIFIER",      ["growlnotify"], {notFs: true});

/*
 * jshint
 */
set("JSHINT",        [env.LK_SCRIPTS_ROOT + "/node_modules/jshint/bin/hint", which('jshint')]);
set("JSHINT_CONFIG", [env.LK_SCRIPTS_ROOT + "/jshint.config"]);


/*
 * workspace
 */
set("WORKSPACE_DIR", [lkScriptDir('/workspace')], {useLastIfNothingIsValid: true});
set("WORKSPACE_LK",  [lkScriptDir('/workspace/lk'), {useLastIfNothingIsValid: true}]);
set("WORKSPACE_WW",  [lkScriptDir('/workspace/ww')], {useLastIfNothingIsValid: true});

set("WORKSPACE_LK_EXISTS", [fs.existsSync(env.WORKSPACE_LK)], {notFs: true});
set("WORKSPACE_WW_EXISTS", [fs.existsSync(env.WORKSPACE_WW)], {notFs: true});
<commit_msg>adding chrome and firefox env vars<commit_after>/*global exports, require, console, process, __dirname*/

var fs = require('fs'),
    path = require('path'),
    Seq = require('seq'),
    shelljs = require('shelljs'),
    which = shelljs.which,
    env = process.env;

function lkScriptDir(dirInRoot) {
    return path.normalize(env.LK_SCRIPTS_ROOT + dirInRoot);
}

function set(varName, choices, options) {
    var isValid = options && options.notFs ? function(c) { return !!c; } : fs.existsSync;
    choices.unshift(env[varName]); // already set?
    for (var i = 0; i < choices.length; i++) {
	    if (isValid(choices[i])) { return env[varName] = choices[i]; }
    }
    return env[varName] = options && options.useLastIfNothingIsValid ? choices.pop() : undefined;
}

/*
 * general stuff
 */
set("LK_SCRIPTS_ROOT", [path.normalize(__dirname + '/..')]);
set("LK_SCRIPTS_DIR",  [lkScriptDir("/scripts")]);
set("NODE_BIN",		   [which('node'), shelljs.which('node.exe')]);
set("NODEMODULES",	   [lkScriptDir("/node_modules")]);
set("NODEUNIT",		   [env.NODEMODULES + "/nodeunit/bin/nodeunit", which('nodeunit')]);
set("NODEMON",		   [env.NODEMODULES + "/nodemon/nodemon.js"], which('nodemon'));
set("FOREVER",		   [env.NODEMODULES + "/forever/bin/forever", which('forever')]);
set("TEMP_DIR",		   [env.TMP, env.TEMP, env.TEMPDIR, '/tmp'], {useLastIfNothingIsValid: true});

/*
 * server related stuff
 * life_star will use miniserver settings
 */
set("MINISERVER_DIR",      [env.LK_SCRIPTS_ROOT + "/minimal_server"]);
set("MINISERVER_PORT",     [9001], {notFs: true});
set("MINISERVER",          [env.MINISERVER_DIR + "/serve.js"]);
set("MINISERVER_HOST",     ["localhost"], {notFs: true});
set("LIFE_STAR_DIR",       [env.LK_SCRIPTS_ROOT + "/life_star"]);
set("LIFE_STAR",           [env.LIFE_STAR_DIR + "/serve.js"]);
// replace with "notesting" to disable test runner interface on server
set("LIFE_STAR_TESTING",   ["testing"], {notFs: true});
// be very chatty about what is going on
set("LIFE_STAR_LOG_LEVEL", ["debug"], {notFs: true});

/*
 * tests
 */
set("MINISERVER_TEST_FILES", [env.MINISERVER_DIR + '/*_test.js'], {notFs: true});
set("LK_TEST_SCRIPT_DIR",    [env.LK_SCRIPTS_DIR + '/testing']);
set("LK_TEST_STARTER",       [env.LK_TEST_SCRIPT_DIR + '/lively_test.js']);
set("LK_TEST_WORLD",         ["run_tests.xhtml"], {notFs: true});
set("LK_TEST_WORLD_SCRIPT",  ["run_tests.js"], {notFs: true});
set("LK_TEST_BROWSER",       ["chrome"], {notFs: true});
set("LK_TEST_TIMEOUT",       [300], {notFs: true});
set("LK_TEST_NOTIFIER",      ["growlnotify"], {notFs: true});

/*
 * web-browser related
 */
set("CHROME_BIN",            [which('chrome'), which('chromium-browser'),
                              "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome",
                              "/usr/bin/chromium-browser",
                              path.join(env.LOCALAPPDATA, 'Google/Chrome/Application/chrome.exe')]);
set("FIREFOX_BIN",            [which('firefox'),
                              "/Applications/Firefox.app/Contents/MacOS/firefox",
                              "/usr/bin/firefox",
                               path.join(env['ProgramFiles(x86)'], 'Mozilla Firefox', 'firefox.exe'),
                               path.join(env.ProgramFiles, 'Mozilla Firefox', 'firefox.exe')]);

/*
 * jshint
 */
set("JSHINT",        [env.LK_SCRIPTS_ROOT + "/node_modules/jshint/bin/hint", which('jshint')]);
set("JSHINT_CONFIG", [env.LK_SCRIPTS_ROOT + "/jshint.config"]);


/*
 * workspace
 */
set("WORKSPACE_DIR", [lkScriptDir('/workspace')], {useLastIfNothingIsValid: true});
set("WORKSPACE_LK",  [lkScriptDir('/workspace/lk'), {useLastIfNothingIsValid: true}]);
set("WORKSPACE_WW",  [lkScriptDir('/workspace/ww')], {useLastIfNothingIsValid: true});

set("WORKSPACE_LK_EXISTS", [fs.existsSync(env.WORKSPACE_LK)], {notFs: true});
set("WORKSPACE_WW_EXISTS", [fs.existsSync(env.WORKSPACE_WW)], {notFs: true});

{'fraction_non_alphanumeric': 0.19406815913303865, 'fraction_numerical': 0.002566661913589049, 'mean_word_length': 4.20326409495549, 'pattern_counts': {'":': 0, '<': 5, '<?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': '2587989', 'n_tokens_mistral': 2618, 'n_tokens_neox': 2541, 'n_words': 425}