<commit_before>#!/usr/bin/env node
var path = require('path'),
	 fs = require('fs'),
	 extend = require('util')._extend,
	 exec = require('child_process').exec,
	 processes = [];

var baseDir = path.resolve(__dirname, '..'),
	 srcDir = path.resolve(baseDir);

var appOptions = {
	port: 3000,
	env: {
		ROOT_URL: 'http://localhost:3000'
	}
};

var chimpSwitches = '';

chimpSwitches +=
	 '--path=tests/steps';

chimpNoMirror();

// *************************************************

function chimpNoMirror() {
	appOptions.waitForMessage = 'App running at';
	startApp(function () {
		startChimp();
	});
}

function startApp(callback) {
	startProcess({
		name: 'Meteor App',
		command: 'meteor --port ' + appOptions.port,
		waitForMessage: appOptions.waitForMessage,
		options: {
			cwd: srcDir,
			env: extend(appOptions.env, process.env)
		}
	}, callback);
}

function startChimp() {
	startProcess({
		name: 'Chimp',
		command: 'meteor npm run chimp-test',
		options: {
			env: Object.assign({}, process.env, {
				NODE_PATH: process.env.NODE_PATH +
					path.delimiter + srcDir +
					path.delimiter + srcDir + '/node_modules',
			}),
		},
	});
}

function startProcess(opts, callback) {
	var proc = exec(
		 opts.command,
		 opts.options
	);
	if (opts.waitForMessage) {
		proc.stdout.on('data', function waitForMessage(data) {
			if (data.toString().match(opts.waitForMessage)) {
				if (callback) {
					callback();
				}
			}
		});
	}
	if (!opts.silent) {
		proc.stdout.pipe(process.stdout);
		proc.stderr.pipe(process.stderr);
	}
	if (opts.logFile) {
		var logStream = fs.createWriteStream(opts.logFile, {flags: 'a'});
		proc.stdout.pipe(logStream);
		proc.stderr.pipe(logStream);
	}
	proc.on('close', function (code) {
		console.log(opts.name, 'exited with code ' + code);
		for (var i = 0; i < processes.length; i += 1) {
			processes[i].kill();
		}
		process.exit(code);
	});
	processes.push(proc);
}<commit_msg>Fix ESLint<commit_after>#!/usr/bin/env node
var path = require('path'),
	fs = require('fs'),
	extend = require('util')._extend,
	exec = require('child_process').exec,
	processes = [];

var baseDir = path.resolve(__dirname, '..'),
	srcDir = path.resolve(baseDir);

var appOptions = {
	port: 3000,
	env: {
		ROOT_URL: 'http://localhost:3000'
	}
};

// *************************************************

function startProcess(opts, callback) {
	var proc = exec(
		opts.command,
		opts.options
	);

	if (opts.waitForMessage) {
		proc.stdout.on('data', function waitForMessage(data) {
			if (data.toString().match(opts.waitForMessage)) {
				if (callback) {
					callback();
				}
			}
		});
	}

	if (!opts.silent) {
		proc.stdout.pipe(process.stdout);
		proc.stderr.pipe(process.stderr);
	}

	if (opts.logFile) {
		var logStream = fs.createWriteStream(opts.logFile, {flags: 'a'});
		proc.stdout.pipe(logStream);
		proc.stderr.pipe(logStream);
	}

	proc.on('close', function(code) {
		console.log(opts.name, 'exited with code ' + code);
		for (var i = 0; i < processes.length; i += 1) {
			processes[i].kill();
		}
		process.exit(code);
	});
	processes.push(proc);
}

function startApp(callback) {
	startProcess({
		name: 'Meteor App',
		command: 'meteor --port ' + appOptions.port,
		waitForMessage: appOptions.waitForMessage,
		options: {
			cwd: srcDir,
			env: extend(appOptions.env, process.env)
		}
	}, callback);
}

function startChimp() {
	startProcess({
		name: 'Chimp',
		command: 'meteor npm run chimp-test',
		options: {
			env: Object.assign({}, process.env, {
				NODE_PATH: process.env.NODE_PATH +
					path.delimiter + srcDir +
					path.delimiter + srcDir + '/node_modules'
			})
		}
	});
}

function chimpNoMirror() {
	appOptions.waitForMessage = 'App running at';
	startApp(function() {
		startChimp();
	});
}

chimpNoMirror();
{'fraction_non_alphanumeric': 0.19574468085106383, 'fraction_numerical': 0.005319148936170213, 'mean_word_length': 3.8404118404118406, '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': '2922872', 'n_tokens_mistral': 1499, 'n_tokens_neox': 1333, 'n_words': 250}