<commit_before>//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Setting

//----------------------------------------------------------------------------------------------------------------------------------------------

var gulp = require('gulp'), S = {}, $ = {
    combineMq:       require("gulp-combine-mq"),
    concat:          require("gulp-concat"),
    if:              require("gulp-if"),
    notify:          require("gulp-notify"),
    plumber:         require("gulp-plumber"),
    postcss:         require("gulp-postcss"),
    rename:          require("gulp-rename"),
    replace:         require("gulp-replace"),
    sass:            require("gulp-sass"),
    uglify:          require("gulp-uglify"),
    zip:             require("gulp-zip"),
    bower:           require("bower"),
    browserSync:     require("browser-sync"),
    cssnano:         require("cssnano"),
    del:             require("del"),
    fs:              require("fs"),
    postcss_cssnext: require("postcss-cssnext"),
    runSequence:     require("run-sequence")
};

S.Extensions = ["analytics", "epubcfi", "jatex", "overreflow", "share", "unzipper"];

S.concat = function() {
    var list = arguments[0];
    for(var i = 1, l = arguments.length; i < l; i++) list = list.concat(arguments[i]);
    return list;
};

S.getVersion = function() {
    return JSON.parse($.fs.readFileSync('package.json')).version;
};

S.getBuildNumber = function() {
    var now = "", date = new Date();
    [
        date.getYear() + 1900,
        date.getMonth() + 1,
        date.getDate(),
        date.getHours(),
        date.getMinutes()/*,
        date.getSeconds()*/
    ].forEach(function(d) {
        now += (d < 10 ? "0" : "") + d;
    });
    return now;
};


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Clean

//----------------------------------------------------------------------------------------------------------------------------------------------

S.clean = function(list) {
    $.del.sync(list);
    return gulp;
};

gulp.task('clean: Scripts', function() {
    return S.clean(ToBeCleaned.Scripts);
});

gulp.task('clean: Styles', function() {
    return S.clean(ToBeCleaned.Styles);
});

gulp.task('clean: Metafiles', function() {
    return S.clean(ToBeCleaned.Metafiles);
});

gulp.task('clean: All', function() {
    return S.clean(ToBeCleaned.All);
});

var ToBeCleaned = {
    Scripts: [
        'bib/i/res/scripts',
        'bib/i/extensions/analytics',
        'bib/i/extensions/epubcfi',
        'bib/i/extensions/jatex',
        'bib/i/extensions/overreflow',
        'bib/i/extensions/share',
        'bib/i/extensions/unzipper',
        'bib/i.js'
    ],
    Styles: [
        'bib/i/res/styles',
        'bib/i.css'
    ],
    Metafiles: [
        'bib/LICENSE',
        'bib/README.md'
    ]
};

ToBeCleaned.All = S.concat(ToBeCleaned.Scripts, ToBeCleaned.Styles, ToBeCleaned.Metafiles);


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Update Metafiles

//----------------------------------------------------------------------------------------------------------------------------------------------

gulp.task('update: JSONs', function() {
    return gulp.src([
        'bower.json',
        'bib/manifest.json'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe($.replace(/"version"(\s*:\s*)".+?"/, '"version"$1"' + S.getVersion() + '"'))
        .pipe(gulp.dest(''));
});

gulp.task('update: README.md', function() {
    return gulp.src([
        'README.md'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe(gulp.dest('bib'));
});

gulp.task('update: LICENSE', function() {
    return gulp.src([
        'LICENSE'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe(gulp.dest('bib'));
});

var Tasks_updateMetafiles = [
    'update: JSONs',
    'update: README.md',
    'update: LICENSE'
];


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Update Bower Components

//----------------------------------------------------------------------------------------------------------------------------------------------

gulp.task('update: bower_components', function() {
    return $.bower.commands.install().on('end', S.update_bower_components_js);
});

gulp.task('update: bower_components.js', S.update_bower_components_js);
<commit_msg>Fix a bug in gulpfile.js.<commit_after>//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Setting

//----------------------------------------------------------------------------------------------------------------------------------------------

var gulp = require('gulp'), S = {}, $ = {
    combineMq:       require("gulp-combine-mq"),
    concat:          require("gulp-concat"),
    if:              require("gulp-if"),
    notify:          require("gulp-notify"),
    plumber:         require("gulp-plumber"),
    postcss:         require("gulp-postcss"),
    rename:          require("gulp-rename"),
    replace:         require("gulp-replace"),
    sass:            require("gulp-sass"),
    uglify:          require("gulp-uglify"),
    zip:             require("gulp-zip"),
    bower:           require("bower"),
    browserSync:     require("browser-sync"),
    cssnano:         require("cssnano"),
    del:             require("del"),
    fs:              require("fs"),
    postcss_cssnext: require("postcss-cssnext"),
    runSequence:     require("run-sequence")
};

S.Extensions = ["analytics", "epubcfi", "jatex", "overreflow", "share", "unzipper"];

S.concat = function() {
    var list = arguments[0];
    for(var i = 1, l = arguments.length; i < l; i++) list = list.concat(arguments[i]);
    return list;
};

S.getVersion = function() {
    return JSON.parse($.fs.readFileSync('package.json')).version;
};

S.getBuildNumber = function() {
    var now = "", date = new Date();
    [
        date.getYear() + 1900,
        date.getMonth() + 1,
        date.getDate(),
        date.getHours(),
        date.getMinutes()/*,
        date.getSeconds()*/
    ].forEach(function(d) {
        now += (d < 10 ? "0" : "") + d;
    });
    return now;
};


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Clean

//----------------------------------------------------------------------------------------------------------------------------------------------

S.clean = function(list) {
    $.del.sync(list);
    return gulp;
};

gulp.task('clean: Scripts', function() {
    return S.clean(ToBeCleaned.Scripts);
});

gulp.task('clean: Styles', function() {
    return S.clean(ToBeCleaned.Styles);
});

gulp.task('clean: Metafiles', function() {
    return S.clean(ToBeCleaned.Metafiles);
});

gulp.task('clean: All', function() {
    return S.clean(ToBeCleaned.All);
});

var ToBeCleaned = {
    Scripts: [
        'bib/i/res/scripts',
        'bib/i/extensions/analytics',
        'bib/i/extensions/epubcfi',
        'bib/i/extensions/jatex',
        'bib/i/extensions/overreflow',
        'bib/i/extensions/share',
        'bib/i/extensions/unzipper',
        'bib/i.js'
    ],
    Styles: [
        'bib/i/res/styles',
        'bib/i.css'
    ],
    Metafiles: [
        'bib/LICENSE',
        'bib/README.md'
    ]
};

ToBeCleaned.All = S.concat(ToBeCleaned.Scripts, ToBeCleaned.Styles, ToBeCleaned.Metafiles);


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Update Metafiles

//----------------------------------------------------------------------------------------------------------------------------------------------

gulp.task('update: JSONs', function() {
    return gulp.src([
        'bower.json',
        'bib/manifest.json'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe($.replace(/"version"(\s*:\s*)".+?"/, '"version"$1"' + S.getVersion() + '"'))
        .pipe(gulp.dest(''));
});

gulp.task('update: README.md', function() {
    return gulp.src([
        'README.md'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe(gulp.dest('bib'));
});

gulp.task('update: LICENSE', function() {
    return gulp.src([
        'LICENSE'
    ])
        .pipe($.plumber({ errorHandler: $.notify.onError('<%= error.message %>') }))
        .pipe(gulp.dest('bib'));
});

var Tasks_updateMetafiles = [
    'update: JSONs',
    'update: README.md',
    'update: LICENSE'
];


//==============================================================================================================================================
//----------------------------------------------------------------------------------------------------------------------------------------------

//-- Update Bower Components

//----------------------------------------------------------------------------------------------------------------------------------------------

gulp.task('update: bower_components', function() {
    return $.bower.commands.install().on('end', S.update_bower_components_js);
});

gulp.task('update: bower_components.js', function() {
    return S.update_bower_components_js();
});

{'fraction_non_alphanumeric': 0.4527657216732847, 'fraction_numerical': 0.0020315818635146367, 'mean_word_length': 1.423360930857015, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 9, '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': '7002544', 'n_tokens_mistral': 2753, 'n_tokens_neox': 2636, 'n_words': 404}