<commit_before>    // general stuff
var gulp = require("gulp"),                      // gulp
    fs = require("fs"),                          // the file system
    notify = require("gulp-notify"),             // notifications
    plumber = require("gulp-plumber"),           // prevent pipe breaking
    runSequence = require("run-sequence"),       // allow tasks to be ran in sequence
    json = require("json-file"),                 // read/write JSON files
    prompt = require("gulp-prompt")              // allow user input
    argv = require("yargs").argv,                // --flags
    del = require("del"),                        // delete files & folders
    newer = require("gulp-newer"),               // checks if files are newer
    merge = require("merge-stream"),             // merge streams
    gulpif = require("gulp-if"),                 // if statements in pipes
    watch = require("gulp-watch"),               // watch for file changes
    sourcemaps = require("gulp-sourcemaps"),     // sourcemaps
    concat = require("gulp-concat"),             // concatenater
    fileinclude = require("gulp-file-include"),  // file includer, variable replacer

    // media stuff
    imagemin = require("gulp-imagemin"),         // image compressor
    pngquant = require("imagemin-pngquant"),     // image compressor for PNGs

    // JS stuff
    jshint = require("gulp-jshint"),             // linter
    uglify = require("gulp-uglify"),             // concatenater

    // CSS stuff
    sass = require("gulp-sass"),                 // SCSS compiler
    autoprefixer = require("gulp-autoprefixer"), // autoprefix CSS

    // FTP stuff
    ftp = require("vinyl-ftp"),                  // FTP client

    ftpHost = "",                                // FTP hostname (leave blank)
    ftpUser = "",                                // FTP username (leave blank)
    ftpPass = "",                                // FTP password (leave blank)
    ftpPath = "",                                // FTP path (leave blank)

    // browser-sync stuff
    browserSync = require("browser-sync"),       // browser-sync

    bsProxy = "",                                // browser-sync proxy (leave blank)
    bsPort = "",                                 // browser-sync port (leave blank)
    bsOpen = "",                                 // browser-sync open (leave blank)
    bsNotify = "",                               // browser-sync notify (leave blank)

    // read data from package.json
    name = json.read("./package.json").get("name"),
    description = json.read("./package.json").get("description"),
    version = json.read("./package.json").get("version"),
    repository = json.read("./package.json").get("repository"),
    license = json.read("./package.json").get("license"),

    // set up environment paths
    src = "./src",   // source directory
    dev = "./dev",   // development directory
    dist = "./dist", // production directory

    ranTasks = []; // store which tasks where ran

// Error handling
var onError = function(err) {
    notify.onError({
        title:    "Gulp",
        subtitle: "Error!",
        message:  "<%= error.message %>",
        sound:    "Beep"
    })(err);

    this.emit("end");
};

// media task, compresses images & copies media
gulp.task("media", function () {
    "use strict";

    // development media directory
    var mediaDirectory = dev + "/assets/media";
    var screenshotDirectory = dev;

    // production media directory (if --dist is passed)
    if (argv.dist) {
        mediaDirectory = dist + "/assets/media";
        screenshotDirectory = dist;
    }

    // clean directory if --clean is passed
    if (argv.clean) {
        del(mediaDirectory + "/**/*");
        del(screenshotDirectory + "/screenshot.png");
    }

    // compress images, copy media
    var media = gulp.src(src + "/assets/media/**/*")
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(mediaDirectory)))
        // compress images
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        // output to the compiled directory
        .pipe(gulp.dest(mediaDirectory));

    // compress screenshot
    var screenshot = gulp.src(src + "/screenshot.png")
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(screenshotDirectory)))
        // compress screenshot
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        // output to the compiled directory
        .pipe(gulp.dest(screenshotDirectory));

    // merge both steams back in to one
    return merge(media, screenshot)
        // reload the files
        .pipe(browserSync.reload({stream: true}))
        // notify that the task is complete, if not part of default or watch
        .pipe(gulpif(gulp.seq.indexOf("media") > gulp.seq.indexOf("default"), notify({title: "Success!", message: "Media task complete!", onLast: true})))
        // push the task to the ranTasks array
        .on("data", function() {
            if (ranTasks.indexOf("media") < 0) ranTasks.push("media");
        });
});

// scripts task, concatenates & lints JS
gulp.task("scripts", function () {
    "use strict";

    // development JS directory
    var jsDirectory = dev + "/assets/scripts";

    // production JS directory (if --dist is passed)
    if (argv.dist) jsDirectory = dist + "/assets/scripts";

    // clean directory if --clean is passed
    if (argv.clean) del(jsDirectory + "/**/*");

    // lint scripts
    var linted = gulp.src([src + "/assets/scripts/*.js", "!" + src + "/assets/scripts/vendor.*.js"])
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(jsDirectory)))
        // lint all non-vendor scripts
        .pipe(jshint())<commit_msg>Fix an issue where scripts task would always run<commit_after>    // general stuff
var gulp = require("gulp"),                      // gulp
    fs = require("fs"),                          // the file system
    notify = require("gulp-notify"),             // notifications
    plumber = require("gulp-plumber"),           // prevent pipe breaking
    runSequence = require("run-sequence"),       // allow tasks to be ran in sequence
    json = require("json-file"),                 // read/write JSON files
    prompt = require("gulp-prompt")              // allow user input
    argv = require("yargs").argv,                // --flags
    del = require("del"),                        // delete files & folders
    newer = require("gulp-newer"),               // checks if files are newer
    merge = require("merge-stream"),             // merge streams
    gulpif = require("gulp-if"),                 // if statements in pipes
    watch = require("gulp-watch"),               // watch for file changes
    sourcemaps = require("gulp-sourcemaps"),     // sourcemaps
    concat = require("gulp-concat"),             // concatenater
    fileinclude = require("gulp-file-include"),  // file includer, variable replacer

    // media stuff
    imagemin = require("gulp-imagemin"),         // image compressor
    pngquant = require("imagemin-pngquant"),     // image compressor for PNGs

    // JS stuff
    jshint = require("gulp-jshint"),             // linter
    uglify = require("gulp-uglify"),             // concatenater

    // CSS stuff
    sass = require("gulp-sass"),                 // SCSS compiler
    autoprefixer = require("gulp-autoprefixer"), // autoprefix CSS

    // FTP stuff
    ftp = require("vinyl-ftp"),                  // FTP client

    ftpHost = "",                                // FTP hostname (leave blank)
    ftpUser = "",                                // FTP username (leave blank)
    ftpPass = "",                                // FTP password (leave blank)
    ftpPath = "",                                // FTP path (leave blank)

    // browser-sync stuff
    browserSync = require("browser-sync"),       // browser-sync

    bsProxy = "",                                // browser-sync proxy (leave blank)
    bsPort = "",                                 // browser-sync port (leave blank)
    bsOpen = "",                                 // browser-sync open (leave blank)
    bsNotify = "",                               // browser-sync notify (leave blank)

    // read data from package.json
    name = json.read("./package.json").get("name"),
    description = json.read("./package.json").get("description"),
    version = json.read("./package.json").get("version"),
    repository = json.read("./package.json").get("repository"),
    license = json.read("./package.json").get("license"),

    // set up environment paths
    src = "./src",   // source directory
    dev = "./dev",   // development directory
    dist = "./dist", // production directory

    ranTasks = []; // store which tasks where ran

// Error handling
var onError = function(err) {
    notify.onError({
        title:    "Gulp",
        subtitle: "Error!",
        message:  "<%= error.message %>",
        sound:    "Beep"
    })(err);

    this.emit("end");
};

// media task, compresses images & copies media
gulp.task("media", function () {
    "use strict";

    // development media directory
    var mediaDirectory = dev + "/assets/media";
    var screenshotDirectory = dev;

    // production media directory (if --dist is passed)
    if (argv.dist) {
        mediaDirectory = dist + "/assets/media";
        screenshotDirectory = dist;
    }

    // clean directory if --clean is passed
    if (argv.clean) {
        del(mediaDirectory + "/**/*");
        del(screenshotDirectory + "/screenshot.png");
    }

    // compress images, copy media
    var media = gulp.src(src + "/assets/media/**/*")
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(mediaDirectory)))
        // compress images
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        // output to the compiled directory
        .pipe(gulp.dest(mediaDirectory));

    // compress screenshot
    var screenshot = gulp.src(src + "/screenshot.png")
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(screenshotDirectory)))
        // compress screenshot
        .pipe(imagemin({
            progressive: true,
            svgoPlugins: [{removeViewBox: false}],
            use: [pngquant()]
        }))
        // output to the compiled directory
        .pipe(gulp.dest(screenshotDirectory));

    // merge both steams back in to one
    return merge(media, screenshot)
        // reload the files
        .pipe(browserSync.reload({stream: true}))
        // notify that the task is complete, if not part of default or watch
        .pipe(gulpif(gulp.seq.indexOf("media") > gulp.seq.indexOf("default"), notify({title: "Success!", message: "Media task complete!", onLast: true})))
        // push the task to the ranTasks array
        .on("data", function() {
            if (ranTasks.indexOf("media") < 0) ranTasks.push("media");
        });
});

// scripts task, concatenates & lints JS
gulp.task("scripts", function () {
    "use strict";

    // development JS directory
    var jsDirectory = dev + "/assets/scripts";

    // production JS directory (if --dist is passed)
    if (argv.dist) jsDirectory = dist + "/assets/scripts";

    // clean directory if --clean is passed
    if (argv.clean) del(jsDirectory + "/**/*");

    // lint scripts
    var linted = gulp.src([src + "/assets/scripts/*.js", "!" + src + "/assets/scripts/vendor.*.js"])
        // check if source is newer than destination
        .pipe(gulpif(!argv.force, newer(jsDirectory + "/all.js")))
        // lint all non-vendor scripts
        .pipe(jshint())
{'fraction_non_alphanumeric': 0.14042268816306072, 'fraction_numerical': 0.00016707042018210676, 'mean_word_length': 1.84979766722209, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6381519', 'n_tokens_mistral': 3251, 'n_tokens_neox': 3128, 'n_words': 876}