<commit_before>#!/usr/bin/env node

// Default Dependencies
var path = require('path'),
    fs = require('fs'),
    os = require('os'),
	shell = require('../../enyo/tools/node_modules/shelljs');

// Local variables
var srcDir = process.cwd(),
	tDir = path.resolve(srcDir, 'test'),
	rDir = path.resolve(tDir, 'root'),
	testDir = path.resolve(srcDir, 'test/root'),
	newProjectDir = path.resolve(srcDir, 'test/root/NewProject'),
	helloTestDir = path.resolve(srcDir, 'test/root/HelloWorld'),
	helloSrcDir = path.resolve(srcDir, 'test/samples/HelloWorld'),
	lib = path.resolve(srcDir, 'test/root/HelloWorld/lib'),
	fopsTestDir = path.resolve(srcDir, 'test/root/FileOps'),
	fopsSrcDir = path.resolve(srcDir, 'test/samples/FileOps');

// cleanup and set up the dedicated source tree either for TestRunner and Selenium
// console.log("os.type(): "+ os.type());
// cleanup test/root
shell.cd(path.join(tDir));
shell.rm('-rf', path.join(rDir));

// setup test/root and sub-directories
shell.mkdir('-p', path.join(testDir));
shell.mkdir('-p', path.join(newProjectDir));
shell.mkdir('-p', path.join(helloTestDir));
shell.mkdir('-p', path.join(fopsTestDir));

// import the HelloWorld project and dependencies from test/samples
shell.cp('-R', path.join(helloSrcDir), path.join(testDir));
shell.cd(path.join(helloTestDir));
shell.mkdir('-p', path.join(lib));
if (os.type() === 'Windows_NT') {
	var enyoDir = path.resolve(tDir, '../enyo'),
	 	layoutDir = path.resolve(tDir, '../lib/layout'),
	 	onyxDir = path.resolve(tDir, '../lib/onyx'),
	 	lib = path.resolve(testDir, 'HelloWorld/lib');
	shell.cp('-R', path.join(enyoDir), path.join(helloTestDir));
	shell.cd('lib');
	shell.cp('-R', path.join(layoutDir), path.join(lib));
	shell.cp('-R', path.join(onyxDir), path.join(lib));
} else {
	// symlinks foes not exist on Windows
	shell.exec('/bin/ln -s ../../../enyo enyo');
	shell.exec('/bin/ln -s ../../../../lib/layout lib/layout');
	shell.exec('/bin/ln -s ../../../../lib/onyx lib/onyx');	
}
// import the FileOps dir from test/samples
shell.cd(path.join(fopsTestDir));
shell.cp('-R', path.join(fopsSrcDir), path.join(testDir));<commit_msg>ENYO-1848 test/tester/main.js rewrite as installer Enyo-DCO-1.1-Signed-off-by: <NAME> (Marian) <EMAIL><commit_after>var path = require('path'),
    fs = require('fs'),
    os = require('os'),
    npmlog = require('./../../node_modules/npmlog'),
	shell = require('./../../enyo/tools/node_modules/shelljs');

var srcDir = process.cwd(),
	tDir = path.resolve(srcDir, 'test'),
	rDir = path.resolve(tDir, 'root'),
	testDir = path.resolve(srcDir, 'test/root'),
	newProjectDir = path.resolve(srcDir, 'test/root/NewProject'),
	helloTestDir = path.resolve(srcDir, 'test/root/HelloWorld'),
	helloSrcDir = path.resolve(srcDir, 'test/samples/HelloWorld'),
	lib = path.resolve(srcDir, 'test/root/HelloWorld/lib'),
	fopsTestDir = path.resolve(srcDir, 'test/root/FileOps'),
	fopsSrcDir = path.resolve(srcDir, 'test/samples/FileOps');

var enyoDir = path.resolve(tDir, '../enyo'),
 	layoutDir = path.resolve(tDir, '../lib/layout'),
 	onyxDir = path.resolve(tDir, '../lib/onyx'),
 	lib = path.resolve(testDir, 'HelloWorld/lib');

(function() {

        var log = npmlog;
        log.heading = 'installer';
        log.level = 'warn';

        var tester = {
        	setup: function(req, res, next) {
 				// cleanup and set up the dedicated source tree either for TestRunner and Selenium
				// console.log("os.type(): "+ os.type());
				// cleanup test/root
				shell.cd(path.join(tDir));
				shell.rm('-rf', path.join(rDir));

				// setup test/root and sub-directories
				shell.mkdir('-p', path.join(testDir));
				shell.mkdir('-p', path.join(newProjectDir));
				shell.mkdir('-p', path.join(helloTestDir));
				shell.mkdir('-p', path.join(fopsTestDir));

				// import the HelloWorld project and dependencies from test/samples
				shell.cp('-R', path.join(helloSrcDir), path.join(testDir));
				shell.cd(path.join(helloTestDir));
				shell.mkdir('-p', path.join(lib));
				if (os.type() === 'Windows_NT') {
					shell.cp('-R', path.join(enyoDir), path.join(helloTestDir));
					shell.cd('lib');
					shell.cp('-R', path.join(layoutDir), path.join(lib));
					shell.cp('-R', path.join(onyxDir), path.join(lib));
				} else {
					// symlinks foes not exist on Windows
					shell.exec('/bin/ln -s ../../../enyo enyo');
					shell.exec('/bin/ln -s ../../../../lib/layout lib/layout');
					shell.exec('/bin/ln -s ../../../../lib/onyx lib/onyx');	
				}
				// import the FileOps dir from test/samples
				shell.cd(path.join(fopsTestDir));
				shell.cp('-R', path.join(fopsSrcDir), path.join(testDir));

				console.log('Ares Test setup done!');
				res.status(200);
				next();
			},
			cleanup: function(req, res, next) {
				next();
			}
		};

        if (typeof module !== 'undefined' && module.exports) {
                module.exports = tester;
        }
        
}());
{'fraction_non_alphanumeric': 0.20773638968481375, 'fraction_numerical': 0.0018419975440032747, 'mean_word_length': 3.504147465437788, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '7349536', 'n_tokens_mistral': 1854, 'n_tokens_neox': 1700, 'n_words': 327}