<commit_before>var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var fs = require('fs');

var gulp = require('gulp');
var source = require('vinyl-source-stream');
var through2 = require('through2');
var $ = require('gulp-load-plugins')();
var del = require('del');
var pem = require('pem');
var rsync = require('rsync');
var pngquant = require('imagemin-pngquant');
var sprite = require('css-sprite').stream;
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');//http://www.browsersync.io/docs/gulp/
var reload = browserSync.reload;
var pagespeed = require('psi');
var cachebust = new $.cachebust();
require('date-utils');

//values
var conf = require('./package.json');
var projectName = conf.name;
//not available project names
var notAvailableNames = conf.project.invalidNames;
if(notAvailableNames.split('|').indexOf(projectName)!=-1){
    console.log('\n"'+notAvailableNames + '" are not available project names!\n');
    return;
}
var title = conf.project.title || conf.name;
var viewport = conf.project.viewport || 'device-width';
var globalVersion = conf.version;
var distPath = './dist/';
var distProjectPath = distPath + projectName;
var sourceImg = conf.project.sourceImg;//source images path to copy to this project
var sourceSprites = conf.project.sourceSprites;//source images path to generate sprites

//build version:
//script version
//style version
//manifest version
var startTime = 0;
var buildVersion = 0;
gulp.task('build_version', function (cb) {
    var startDate = new Date();
    startTime = startDate.getTime();
    buildVersion = startDate.toFormat('YYYYMMDDHHMISS');

    cb();
});

//copy source images to "/resources/images"
gulp.task('copy:source_imgs', function () {
    return gulp.src([sourceImg])
        .pipe(gulp.dest('./resources/images'))
        .pipe($.size({title: 'copy source images'}));
});

// generate sprites.png and _debug-sprites.scss
gulp.task('sprites', function () {
    return gulp.src(sourceSprites)
        .pipe(sprite({
            name: 'sprites',
            style: '_debug-sprites.scss',
            cssPath: '../images/',
            processor: 'css'
        }))
        .pipe($.if('*.png', gulp.dest('./resources/images/'), gulp.dest('./scss/')))
        .pipe($.size({title: 'sprites'}));
});

//clear
//clear images
gulp.task('clean:images', function (cb) {
    del(['./resources/images/*'], {force: true}, cb);
});
//clear dist folder
gulp.task('clean:dist', function (cb) {
    del([distPath + '*'], {force: true}, cb);
});

//watching script change to start default task
gulp.task('watch', function () {
    return gulp.watch([
        'gulpfile.js', 'src/**/*.js', '!src/app.js',
        'scss/**/*.scss',
        'html/site/**/*.html'
    ], function (event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
        if(/.*\.js$/.test(event.path)){
            //jshint
            conf.project.watchJshint && gulp.src(event.path)
                .pipe($.jshint())
                .pipe($.jshint.reporter('jshint-stylish'));

            runSequence('requirejs');
        }
        else if(/.*\.scss$/.test(event.path)){
            //scsslint
            //https://github.com/noahmiller/gulp-scsslint
            conf.project.watchScsslint && gulp.src(event.path)
                .pipe($.scsslint())
                .pipe($.scsslint.reporter());

            runSequence('sass');
        }
        else if(/.*\.html$/.test(event.path)){
            runSequence('include:debug');
        }
    });

});

//compile sass files
var AUTOPREFIXER_BROWSERS = [
    'ie >= 10',
    'ie_mob >= 10',
    'ff >= 30',
    'chrome >= 34',
    'safari >= 7',
    'opera >= 23',
    'ios >= 7',
    'android >= 4.4',
    'bb >= 10'
];
gulp.task('sass', function () {
    return gulp.src(['./scss/*.scss'],{buffer:true})
        .pipe($.replace(/_VIEWPORT_WIDTH_/g,conf.project.viewport||640))
        .pipe(gulp.dest('./.scss'))//fix replace not working
        .pipe($.sourcemaps.init())
        .pipe($.sass({errLogToConsole: true}))
        .pipe($.sourcemaps.write())
        .pipe($.cached('build-cache', {
            optimizeMemory: true
        }))
        .pipe($.autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))
        .pipe(gulp.dest('./resources/css/')).on('end',function(){
            del(['./.scss'], {force: true});
        });<commit_msg>fix sass task for window<commit_after>var spawn = require('child_process').spawn;
var exec = require('child_process').exec;
var fs = require('fs');

var gulp = require('gulp');
var source = require('vinyl-source-stream');
var through2 = require('through2');
var $ = require('gulp-load-plugins')();
var del = require('del');
var pem = require('pem');
var rsync = require('rsync');
var pngquant = require('imagemin-pngquant');
var sprite = require('css-sprite').stream;
var runSequence = require('run-sequence');
var browserSync = require('browser-sync');//http://www.browsersync.io/docs/gulp/
var reload = browserSync.reload;
var pagespeed = require('psi');
var cachebust = new $.cachebust();
require('date-utils');

//values
var conf = require('./package.json');
var projectName = conf.name;
//not available project names
var notAvailableNames = conf.project.invalidNames;
if(notAvailableNames.split('|').indexOf(projectName)!=-1){
    console.log('\n"'+notAvailableNames + '" are not available project names!\n');
    return;
}
var title = conf.project.title || conf.name;
var viewport = conf.project.viewport || 'device-width';
var globalVersion = conf.version;
var distPath = './dist/';
var distProjectPath = distPath + projectName;
var sourceImg = conf.project.sourceImg;//source images path to copy to this project
var sourceSprites = conf.project.sourceSprites;//source images path to generate sprites

//build version:
//script version
//style version
//manifest version
var startTime = 0;
var buildVersion = 0;
gulp.task('build_version', function (cb) {
    var startDate = new Date();
    startTime = startDate.getTime();
    buildVersion = startDate.toFormat('YYYYMMDDHHMISS');

    cb();
});

//copy source images to "/resources/images"
gulp.task('copy:source_imgs', function () {
    return gulp.src([sourceImg])
        .pipe(gulp.dest('./resources/images'))
        .pipe($.size({title: 'copy source images'}));
});

// generate sprites.png and _debug-sprites.scss
gulp.task('sprites', function () {
    return gulp.src(sourceSprites)
        .pipe(sprite({
            name: 'sprites',
            style: '_debug-sprites.scss',
            cssPath: '../images/',
            processor: 'css'
        }))
        .pipe($.if('*.png', gulp.dest('./resources/images/'), gulp.dest('./scss/')))
        .pipe($.size({title: 'sprites'}));
});

//clear
//clear images
gulp.task('clean:images', function (cb) {
    del(['./resources/images/*'], {force: true}, cb);
});
//clear dist folder
gulp.task('clean:dist', function (cb) {
    del([distPath + '*'], {force: true}, cb);
});

//watching script change to start default task
gulp.task('watch', function () {
    return gulp.watch([
        'gulpfile.js', 'src/**/*.js', '!src/app.js',
        'scss/**/*.scss',
        'html/site/**/*.html'
    ], function (event) {
        console.log('File ' + event.path + ' was ' + event.type + ', running tasks...');
        if(/.*\.js$/.test(event.path)){
            //jshint
            conf.project.watchJshint && gulp.src(event.path)
                .pipe($.jshint())
                .pipe($.jshint.reporter('jshint-stylish'));

            runSequence('requirejs');
        }
        else if(/.*\.scss$/.test(event.path)){
            //scsslint
            //https://github.com/noahmiller/gulp-scsslint
            conf.project.watchScsslint && gulp.src(event.path)
                .pipe($.scsslint())
                .pipe($.scsslint.reporter());

            runSequence('sass');
        }
        else if(/.*\.html$/.test(event.path)){
            runSequence('include:debug');
        }
    });

});

//compile sass files
var AUTOPREFIXER_BROWSERS = [
    'ie >= 10',
    'ie_mob >= 10',
    'ff >= 30',
    'chrome >= 34',
    'safari >= 7',
    'opera >= 23',
    'ios >= 7',
    'android >= 4.4',
    'bb >= 10'
];
gulp.task('sass', function (cb) {
    gulp.src(['./scss/*.scss'],{buffer:true})
        .pipe($.replace(/_VIEWPORT_WIDTH_/g,conf.project.viewport||640))
        .pipe(gulp.dest('./.scss'))//fix replace not working
        .on('end',function(){
            gulp.src(['./.scss/*.scss'],{buffer:true})
                .pipe($.sourcemaps.init())
                .pipe($.sass({errLogToConsole: true}))
                .pipe($.sourcemaps.write())
                .pipe($.cached('build-cache', {
                    optimizeMemory: true
                }))
                .pipe($.autoprefixer({browsers: AUTOPREFIXER_BROWSERS}))
                .pipe(gulp.dest('./resources/css/'))
                .on('end',function(){
                    del(['./.scss'], {force: true});
                    cb();
                });
        });
{'fraction_non_alphanumeric': 0.19318933215781353, 'fraction_numerical': 0.005289839100727353, 'mean_word_length': 2.674089068825911, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 21, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '6411660', 'n_tokens_mistral': 2965, 'n_tokens_neox': 2867, 'n_words': 568}