<commit_before>#!/usr/bin/env node
/* globals rm,mkdir,target,cp,echo,env,exec */

require('shelljs/make');
var maven = require('maven-deploy');
var path = require('path');

var dotbin = require('./util/dotbin.js');

var browserify = dotbin('browserify');
var uglify = dotbin('uglifyjs');
var codestyle = dotbin('finn-js-code-style');
var karma = makeCmd('./node_modules/karma/bin/karma');

function makeCmd (unixPath) {
    var path = platformPath(unixPath);
    return function () {
        exec([path].concat([].slice.call(arguments, 0)).join(' '));
    };
}

function platformPath(p) {
    return p.split('/').join(path.sep);
}

function setupPhantomPath() {
    if (!env['PHANTOMJS_BIN']) {
        try {
            var path  = require('phantomjs2').path;
            if (path) {
                env['PHANTOMJS_BIN'] = path;
            }
            if (!path) {
                path  = require('phantomjs').path;
                if (path) {
                    env['PHANTOMJS_BIN'] = path;
                }
            }
        } catch(e){}
    }
}

maven.config(require('./maven-config.json'));

target.build = function() {
    rm('-rf', 'dist');
    mkdir('-p', 'dist/js/gardr', 'dist/js/gardr/app', 'dist/js/gardr/desktop', 'dist/js/gardr/mobile');

    ['desktop/host', 'mobile/host'].map(function(name) {
        browserify('-s', 'gardr src/{name}.js -o dist/js/gardr/{name}.js'.replace(/{name}/g, name));
        uglify('dist/js/gardr/{name}.js -m -c -o dist/js/gardr/{name}.min.js'.replace(/{name}/g, name));
    });

    ['app/ext', 'desktop/ext', 'mobile/ext'].map(function(name) {
        browserify('src/{name}.js -o dist/js/gardr/{name}.dev.js'.replace(/{name}/g, name));
        uglify('dist/js/gardr/{name}.dev.js -m -c -o dist/js/gardr/{name}.js'.replace(/{name}/g, name));
    });

    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/app/iframe.htm');
    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/desktop/iframe.htm');
    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/mobile/iframe.htm');
};

target.lint = function() {
    codestyle('src', 'test', 'util');
};

target.test = function () {
    setupPhantomPath();
    exec('npm test');
};

target.ci = function () {
    target.build();
    target.lint();
    ['ie', 'ienew', 'chrome', 'android', 'ios', 'firefox'].forEach(function(browserType){
        env['BROWSER_TYPE'] = browserType;
        karma('start', '--single-run');
    });
};

target.install = function() {
    target.build();
    maven.install();
};

target.snapshot = function() {
    target.build();
    maven.deploy('finntech-internal-snapshot', true);
};

target.release = function() {
    target.build();
    var args = process.argv.slice(3);
    var nextVersion = args.shift() || 'patch';

    echo('npm version ' + nextVersion);
    echo('git push --follow-tags origin master');
    maven.deploy('finntech-internal-release', false);
};

target.all = target.build;
<commit_msg>exec commands intead of echo when releasing<commit_after>#!/usr/bin/env node
/* globals rm,mkdir,target,cp,echo,env,exec */

require('shelljs/make');
var maven = require('maven-deploy');
var path = require('path');

var dotbin = require('./util/dotbin.js');

var browserify = dotbin('browserify');
var uglify = dotbin('uglifyjs');
var codestyle = dotbin('finn-js-code-style');
var karma = makeCmd('./node_modules/karma/bin/karma');

function makeCmd (unixPath) {
    var path = platformPath(unixPath);
    return function () {
        exec([path].concat([].slice.call(arguments, 0)).join(' '));
    };
}

function platformPath(p) {
    return p.split('/').join(path.sep);
}

function setupPhantomPath() {
    if (!env['PHANTOMJS_BIN']) {
        try {
            var path  = require('phantomjs2').path;
            if (path) {
                env['PHANTOMJS_BIN'] = path;
            }
            if (!path) {
                path  = require('phantomjs').path;
                if (path) {
                    env['PHANTOMJS_BIN'] = path;
                }
            }
        } catch(e){}
    }
}

maven.config(require('./maven-config.json'));

target.build = function() {
    rm('-rf', 'dist');
    mkdir('-p', 'dist/js/gardr', 'dist/js/gardr/app', 'dist/js/gardr/desktop', 'dist/js/gardr/mobile');

    ['desktop/host', 'mobile/host'].map(function(name) {
        browserify('-s', 'gardr src/{name}.js -o dist/js/gardr/{name}.js'.replace(/{name}/g, name));
        uglify('dist/js/gardr/{name}.js -m -c -o dist/js/gardr/{name}.min.js'.replace(/{name}/g, name));
    });

    ['app/ext', 'desktop/ext', 'mobile/ext'].map(function(name) {
        browserify('src/{name}.js -o dist/js/gardr/{name}.dev.js'.replace(/{name}/g, name));
        uglify('dist/js/gardr/{name}.dev.js -m -c -o dist/js/gardr/{name}.js'.replace(/{name}/g, name));
    });

    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/app/iframe.htm');
    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/desktop/iframe.htm');
    cp('-f', 'node_modules/gardr-ext/iframe.html', 'dist/js/gardr/mobile/iframe.htm');
};

target.lint = function() {
    codestyle('src', 'test', 'util');
};

target.test = function () {
    setupPhantomPath();
    exec('npm test');
};

target.ci = function () {
    target.build();
    target.lint();
    ['ie', 'ienew', 'chrome', 'android', 'ios', 'firefox'].forEach(function(browserType){
        env['BROWSER_TYPE'] = browserType;
        karma('start', '--single-run');
    });
};

target.install = function() {
    target.build();
    maven.install();
};

target.snapshot = function() {
    target.build();
    maven.deploy('finntech-internal-snapshot', true);
};

target.release = function() {
    target.build();
    var args = process.argv.slice(3);
    var nextVersion = args.shift() || 'patch';

    exec('npm version ' + nextVersion);
    exec('git push --follow-tags origin master');
    maven.deploy('finntech-internal-release', false);
};

target.all = target.build;

{'fraction_non_alphanumeric': 0.2120401337792642, 'fraction_numerical': 0.001003344481605351, 'mean_word_length': 2.9015003261578602, 'pattern_counts': {'":': 0, '<': 3, '<?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': '384525', 'n_tokens_mistral': 2166, 'n_tokens_neox': 2051, 'n_words': 330}