<commit_before>// This is shared gulptasks for all example projects
// To do Sauce Lab tests
var gulp = require(process.cwd() + '/node_modules/gulp');
var testcfg = require('./shared_testconf.js');
var exec = require('child_process').exec;
var TPU = require(process.cwd() + '/node_modules/tcp-port-used');
var child = require('child_process');
var spawn;

var handleExec = function (cb) {
    return function (err, stdout, stderr) {
        console.log(stdout);
        console.warn(stderr);
        cb();
    };
};

var execTask = function (cmd) {
    return function (cb) {
        exec(cmd, handleExec(cb));
    };
};

var spawnTask = function (cmd) {
    return function () {
        var args = cmd.split(' ');
        var C = args.shift();
        spawn = child.spawn(C, args, {stdio: 'inherit'});

        spawn.on('error', function (E) {
            console.warn(E);
        });
    }
};

gulp.task('test_server', ['buildall'], function () {
    spawn = child.spawn('node', ['server.js'], {stdio: 'inherit'});
    spawn.on('error', function (E) {
        console.warn(E);
    });

    TPU.waitUntilUsed(3000, 200, 30000).then(function () {
        gulp.start(['test_end_protractor']);
    });
});

gulp.task('test_run_protractor', execTask(
    'protractor ../shared_testconf.js'
));

gulp.task('generate_badge_json', ['test_run_protractor'], execTask(
    'badge-saucelabs-results ' + testcfg.config.job_basename + ' > badge.json'
));

gulp.task('generate_badge_png', ['generate_badge_json'], execTask(
    'badge-render badge.json badge.html --png badge.png --scale 0.7 -width 490 -height 60'
));

gulp.task('test_end_protractor', ['generate_badge_png'], function () {
    spawn.kill();
});
<commit_msg>try to fix example builds<commit_after>// This is shared gulptasks for all example projects
// To do Sauce Lab tests
var gulp = require(process.cwd() + '/node_modules/gulp');
var testcfg = require('./shared_testconf.js');
var exec = require('child_process').exec;
var TPU = require(process.cwd() + '/node_modules/tcp-port-used');
var child = require('child_process');
var spawn;

var handleExec = function (cb) {
    return function (err, stdout, stderr) {
        console.log(stdout);
        console.warn(stderr);
        cb();
    };
};

var execTask = function (cmd) {
    return function (cb) {
        exec(cmd, handleExec(cb));
    };
};

var spawnTask = function (cmd) {
    return function () {
        var args = cmd.split(' ');
        var C = args.shift();
        spawn = child.spawn(C, args, {stdio: 'inherit'});

        spawn.on('error', function (E) {
            console.warn(E);
        });
    }
};

gulp.task('test_server', ['buildall'], function () {
    spawn = child.spawn('node', ['server.js'], {stdio: 'inherit'});
    spawn.on('error', function (E) {
        console.warn(E);
    });

    TPU.waitUntilUsed(3000, 200, 30000).then(function () {
        gulp.start(['test_end_protractor']);
    });
});

gulp.task('test_run_protractor', execTask(
    'protractor ../shared_testconf.js'
));

gulp.task('generate_badge_json', ['test_run_protractor'], execTask(
    'badge-saucelabs-results ' + testcfg.config.job_basename + ' > badge.json'
));

gulp.task('generate_badge_png', ['generate_badge_json'], execTask(
    'badge-render badge.json badge.html --png badge.png --scale 0.7 -width 490 -height 60'
));

gulp.task('test_end_protractor', ['generate_badge_png'], function () {
    spawn.kill();
    process.exit();
});

{'fraction_non_alphanumeric': 0.17766203703703703, 'fraction_numerical': 0.01099537037037037, 'mean_word_length': 3.3158551810237205, 'pattern_counts': {'":': 0, '<': 3, '<?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': '488822', 'n_tokens_mistral': 1209, 'n_tokens_neox': 1154, 'n_words': 243}