<commit_before>var parentRequire = require('parent-require'),
    gulp = parentRequire('gulp'),
    extend = require('extend'),
    fs = require('fs'),
    path = require('path'),
    watch = require('gulp-debounced-watch'),
    inject = require('gulp-inject'),
    replace = require('gulp-replace'),
    livereload = require('gulp-livereload'),
    webserver = require('gulp-webserver'),
    open = require('open'),
    opened,
    vendorPath = path.join('node_modules', 'gulp-jasmine-livereload-task', 'vendor'),
    template = {
        '1.3': path.join(vendorPath, 'jasmine-1.3.1', 'SpecRunner.html'),
        '2.0': path.join(vendorPath, 'jasmine-2.0.2', 'SpecRunner.html'),
        '2.1': path.join(vendorPath, 'jasmine-2.1.3', 'SpecRunner.html'),
        '2.2': path.join(vendorPath, 'jasmine-2.2.0', 'SpecRunner.html'),
        'peer': path.join('node_modules', 'jasmine', 'SpecRunner.html')
    },
    jshint = {
        '2.6': path.join(vendorPath, 'jshint-2.6.0', 'jshint.js'),
        'peer': path.join('node_modules', 'jshint', 'dist', 'jshint.js')
    },
    defaults = {
        files: undefined,
        jasmine: '2.2',
        livereload: '35729',
        staticAssetsPath: '.',
        specRunner: 'SpecRunner.html',
        jshint: {
            version: '2.6',
            files: [],
            options: {}
        },
        watch: {
            options: {}
        }
    },
    options;

module.exports = function (opts) {
    if (fs.existsSync(template.peer)) {
        defaults.jasmine = 'peer';
        console.log('Installed Jasmine found');
    } else {
        console.log('No installed Jasmine found. Using embedded one');
    }

    if (opts && opts.jshint && opts.jshint.files && opts.jshint.files.length) {
        if (fs.existsSync(jshint.peer)) {
            defaults.jshint.version = 'peer';
            console.log('Installed Jshint found');
        } else {
            console.log('No installed jshint found. Using embedded one');
        }
    }

    options = extend(true, {}, defaults, opts);

    return function () {
        createSpecrunner();
        livereload.listen({
            port: options.livereload
        });
        watch(options.files, options.watch.options, createSpecrunner);
    };
};<commit_msg>fix(peer): support using peer jasmine<commit_after>var parentRequire = require('parent-require'),
    gulp = parentRequire('gulp'),
    extend = require('extend'),
    fs = require('fs'),
    path = require('path'),
    watch = require('gulp-debounced-watch'),
    inject = require('gulp-inject'),
    replace = require('gulp-replace'),
    livereload = require('gulp-livereload'),
    webserver = require('gulp-webserver'),
    open = require('open'),
    opened,
    vendorPath = path.join('node_modules', 'gulp-jasmine-livereload-task', 'vendor'),
    template = {
        '1.3': path.join(vendorPath, 'jasmine-1.3.1', 'SpecRunner.html'),
        '2.0': path.join(vendorPath, 'jasmine-2.0.2', 'SpecRunner.html'),
        '2.1': path.join(vendorPath, 'jasmine-2.1.3', 'SpecRunner.html'),
        '2.2': path.join(vendorPath, 'jasmine-2.2.0', 'SpecRunner.html'),
        'peer': path.join(vendorPath, 'jasmine', 'SpecRunner.html')
    },
    jshint = {
        '2.6': path.join(vendorPath, 'jshint-2.6.0', 'jshint.js'),
        'peer': path.join('node_modules', 'jshint', 'dist', 'jshint.js')
    },
    defaults = {
        files: undefined,
        jasmine: '2.2',
        livereload: '35729',
        staticAssetsPath: '.',
        specRunner: 'SpecRunner.html',
        jshint: {
            version: '2.6',
            files: [],
            options: {}
        },
        watch: {
            options: {}
        }
    },
    options;

module.exports = function (opts) {
    try {
        require.resolve('jasmine-core');
        defaults.jasmine = 'peer';
        console.log('Installed Jasmine found');
    } catch (err) {
        console.error(err)
        console.log('No installed Jasmine found. Using embedded one');
    }

    if (opts && opts.jshint && opts.jshint.files && opts.jshint.files.length) {
        if (fs.existsSync(jshint.peer)) {
            defaults.jshint.version = 'peer';
            console.log('Installed Jshint found');
        } else {
            console.log('No installed jshint found. Using embedded one');
        }
    }

    options = extend(true, {}, defaults, opts);

    return function () {
        createSpecrunner();
        livereload.listen({
            port: options.livereload
        });
        watch(options.files, options.watch.options, createSpecrunner);
    };
};
{'fraction_non_alphanumeric': 0.1696136214800262, 'fraction_numerical': 0.014843920541366514, 'mean_word_length': 2.3592375366568916, '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': '1473291', 'n_tokens_mistral': 1494, 'n_tokens_neox': 1445, 'n_words': 262}