<commit_before>'use strict';

const path = require("path");
const fs = require("fs");

const mkdirp = require("mkdirp");
const async = require("async");
const rimraf = require("rimraf");
const exec = require("child_process").exec;

const installerConfig = require(path.normalize(process.env.PWD + "/../etc/config.js"));
const serviceModule = require("./service");
const mongoModule = require("./mongo");

//set the logger
const logger = require("../utils/utils.js").getLogger();

const SOAJS_RMS = {
	'urac': 'soajs.urac',
	'oauth': 'soajs.oauth',
	'dashboard': 'soajs.dashboard',
	'gateway': "soajs.controller",
	'ui': 'soajs.dashboard.ui'
};

function updateConfigFile(workingDirectory, cb) {
	installerConfig.workingDirectory = workingDirectory;
	let newData = "'use strict';\n\n";
	newData += "module.exports = " + JSON.stringify(installerConfig, null, 2) + ";\n";
	fs.writeFile(path.normalize(process.env.PWD + "/../etc/config.js"), newData, cb);
}

function installConsoleComponents(upgrade, cb) {
	let myPath = installerConfig.workingDirectory + "/node_modules/";
	fs.stat(myPath, (error, stats) => {
		if (error) {
			if (error.code === 'ENOENT' && !stats) {
				//if not found create the directories needed recursively
				mkdirp(myPath, runNPM);
			}
			else {
				return cb(error);
			}
		}
		else {
			runNPM();
		}
	});
	
	function checkIfModuleIsInstalled(oneRepo, cb){
		if(upgrade){
			return cb(null, false);
		}
		logger.debug("checking if repo is downloaded:", oneRepo);
		fs.stat(path.normalize(myPath + "/" + oneRepo), (error, stats) => {
			console.log(error, stats);
			if (error) {<commit_msg>emoved unneeded debug message<commit_after>'use strict';

const path = require("path");
const fs = require("fs");

const mkdirp = require("mkdirp");
const async = require("async");
const rimraf = require("rimraf");
const exec = require("child_process").exec;

const installerConfig = require(path.normalize(process.env.PWD + "/../etc/config.js"));
const serviceModule = require("./service");
const mongoModule = require("./mongo");

//set the logger
const logger = require("../utils/utils.js").getLogger();

const SOAJS_RMS = {
	'urac': 'soajs.urac',
	'oauth': 'soajs.oauth',
	'dashboard': 'soajs.dashboard',
	'gateway': "soajs.controller",
	'ui': 'soajs.dashboard.ui'
};

function updateConfigFile(workingDirectory, cb) {
	installerConfig.workingDirectory = workingDirectory;
	let newData = "'use strict';\n\n";
	newData += "module.exports = " + JSON.stringify(installerConfig, null, 2) + ";\n";
	fs.writeFile(path.normalize(process.env.PWD + "/../etc/config.js"), newData, cb);
}

function installConsoleComponents(upgrade, cb) {
	let myPath = installerConfig.workingDirectory + "/node_modules/";
	fs.stat(myPath, (error, stats) => {
		if (error) {
			if (error.code === 'ENOENT' && !stats) {
				//if not found create the directories needed recursively
				mkdirp(myPath, runNPM);
			}
			else {
				return cb(error);
			}
		}
		else {
			runNPM();
		}
	});
	
	function checkIfModuleIsInstalled(oneRepo, cb){
		if(upgrade){
			return cb(null, false);
		}
		logger.debug("checking if repo is downloaded:", oneRepo);
		fs.stat(path.normalize(myPath + "/" + oneRepo), (error, stats) => {
			if (error) {
{'fraction_non_alphanumeric': 0.1779503105590062, 'fraction_numerical': 0.0006211180124223603, 'mean_word_length': 4.477891156462585, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1840032', 'n_tokens_mistral': 1179, 'n_tokens_neox': 1101, 'n_words': 239}