<commit_before>var shell = require('shelljs'),
    path  = require('path'),
    config= require('../config'),
    fs    = require('fs');

var mobile_spec = path.join(__dirname, '..', 'lib', 'incubator-cordova-mobile-spec');
var junitReporter = path.join(__dirname, '..', 'src', 'junit-reporter.js');
var mobile_spec_out = path.join(__dirname, '..', 'temp', 'mobspec');

module.exports = function() {
    shell.rm('-Rf', mobile_spec_out);
    shell.mkdir('-p', mobile_spec_out);
    var tempAll = path.join(mobile_spec_out, 'autotest', 'pages', 'all.html');

    // copy entire mobile_spec project to mobile_spec_out location
    shell.cp('-Rf', [path.join(mobile_spec, 'autotest'), path.join(mobile_spec, 'cordova.js'), path.join(mobile_spec, 'master.css'), path.join(mobile_spec, 'main.js')], mobile_spec_out);

    // copy junit reporter into mobile_spec_out location
    shell.cp('-Rf', junitReporter, mobile_spec_out);
    
    // get the last SHA for mobile-spec and drop it to the top of the junit reporter
    var sha = shell.exec('cd ' + mobile_spec + ' && git log | head -1', {silent:true}).mobile_spec_out.split(' ')[1].replace(/\s/,'');
    var tempJunit = path.join(mobile_spec_out, 'junit-reporter.js');
    fs.writeFileSync(tempJunit, "var mobile_spec_sha = '" + sha + "';\n" + fs.readFileSync(tempJunit, 'utf-8'), 'utf-8');

    // replace a few lines under the "all" tests autopage
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/<script type=.text.javascript. src=.\.\..html.TrivialReporter\.js.><.script>/, '<script type="text/javascript" src="../html/TrivialReporter.js"></script><script type="text/javascript" src="../../junit-reporter.js"></script>'), 'utf-8');
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/jasmine.HtmlReporter.../, 'jasmine.HtmlReporter(); var jr = new jasmine.JUnitXmlReporter("' + config.server + ':' + config.port + '");'), 'utf-8');
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/addReporter.htmlReporter../, 'addReporter(htmlReporter);jasmineEnv.addReporter(jr);'), 'utf-8');
    console.log('Mobile Spec HTML app is ready.');
}<commit_msg>fixed a find/replace bug introduced.<commit_after>var shell = require('shelljs'),
    path  = require('path'),
    config= require('../config'),
    fs    = require('fs');

var mobile_spec = path.join(__dirname, '..', 'lib', 'incubator-cordova-mobile-spec');
var junitReporter = path.join(__dirname, '..', 'src', 'junit-reporter.js');
var mobile_spec_out = path.join(__dirname, '..', 'temp', 'mobspec');

module.exports = function() {
    shell.rm('-Rf', mobile_spec_out);
    shell.mkdir('-p', mobile_spec_out);
    var tempAll = path.join(mobile_spec_out, 'autotest', 'pages', 'all.html');

    // copy entire mobile_spec project to mobile_spec_out location
    shell.cp('-Rf', [path.join(mobile_spec, 'autotest'), path.join(mobile_spec, 'cordova.js'), path.join(mobile_spec, 'master.css'), path.join(mobile_spec, 'main.js')], mobile_spec_out);

    // copy junit reporter into mobile_spec_out location
    shell.cp('-Rf', junitReporter, mobile_spec_out);
    
    // get the last SHA for mobile-spec and drop it to the top of the junit reporter
    var sha = shell.exec('cd ' + mobile_spec + ' && git log | head -1', {silent:true}).output.split(' ')[1].replace(/\s/,'');
    var tempJunit = path.join(mobile_spec_out, 'junit-reporter.js');
    fs.writeFileSync(tempJunit, "var mobile_spec_sha = '" + sha + "';\n" + fs.readFileSync(tempJunit, 'utf-8'), 'utf-8');

    // replace a few lines under the "all" tests autopage
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/<script type=.text.javascript. src=.\.\..html.TrivialReporter\.js.><.script>/, '<script type="text/javascript" src="../html/TrivialReporter.js"></script><script type="text/javascript" src="../../junit-reporter.js"></script>'), 'utf-8');
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/jasmine.HtmlReporter.../, 'jasmine.HtmlReporter(); var jr = new jasmine.JUnitXmlReporter("' + config.server + ':' + config.port + '");'), 'utf-8');
    fs.writeFileSync(tempAll, fs.readFileSync(tempAll, 'utf-8').replace(/addReporter.htmlReporter../, 'addReporter(htmlReporter);jasmineEnv.addReporter(jr);'), 'utf-8');
    console.log('Mobile Spec HTML app is ready.');
}
{'fraction_non_alphanumeric': 0.19723502304147467, 'fraction_numerical': 0.004608294930875576, 'mean_word_length': 4.460377358490566, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, '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': '3491380', 'n_tokens_mistral': 1493, 'n_tokens_neox': 1473, 'n_words': 288}