{"size": 1232, "ext": "js", "max_stars_repo_path": "gulp_tasks/distribution.js", "max_stars_repo_name": "zombiGoats/oldBMC", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "gulp_tasks/distribution.js", "max_issues_repo_name": "zombiGoats/oldBMC", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "gulp_tasks/distribution.js", "max_forks_repo_name": "zombiGoats/oldBMC", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.7826086957, "max_line_length": 98, "alphanum_fraction": 0.5787337662}
/*eslint-env node */
/*global require: true, module: true */

'use strict';

var options = require('../gulp-options.js'),
    gulp = require('gulp'),
    clean = require('gulp-clean'),
    webapp = require('./webapp.js'),
    imagemin = require('gulp-imagemin');

var runSequence = require('run-sequence');

gulp.task('webapp', function (callback) {
    return webapp(callback);
});

gulp.task('distribution:clean', function () {
    return gulp
        .src([options.dirname + '/dist'], { 'read': false })
        .pipe(clean({'force': true}));
});

gulp.task('distribution:copy', function () {
    return gulp
        .src(['**/*'], { 'cwd': options.targetFolderPath + '/webapp' })
        .pipe(gulp.dest(options.dirname + '/dist'));
});

gulp.task('imagemin', () =>
    gulp.src([options.dirname + '/app/assets/images/*'])
        .pipe(imagemin({
            optimizationLevel: 3,
            progressive: true,
            interlaced: false,
            svgoPlugins: [{
                removeViewBox: false
            }]
        }))
        .pipe(gulp.dest('dist/assets/images'))
);

module.exports = function (callback) {
    return runSequence('distribution:clean', 'webapp', 'distribution:copy', 'imagemin', callback);
};
