<commit_before>var gulp    = require('gulp'),
    gutil   = require('gulp-util'),
    es      = require('event-stream');

var plugins = require('gulp-load-plugins')({
  camelize: true
});

var config = require('./gulpfile.config');

// Default values
var isProduction = false;

if(gutil.env.prod === true) {
    isProduction = true;
}

gulp.task('clean', function() {
  return gulp.src(config.basePaths.dest)
  .pipe(plugins.clean());
});

gulp.task('templates', ['scripts', 'styles'], function() {
  return gulp.src(config.appFiles.templates, {cwd: config.typePaths.templates.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(plugins.jade({ pretty: (isProduction ? false : true) }))

  .pipe(plugins.inject(
    gulp.src(config.typePaths.styles.dest + config.GLOBSTAR, {read: false})
    .pipe(plugins.order(config.styleOrder))
    .pipe(plugins.using({prefix: 'Injecting'})),
      { addRootSlash: false, ignorePath: config.basePaths.dest })
  )
  .pipe(plugins.inject(
    gulp.src(config.typePaths.scripts.dest + config.GLOBSTAR, {read: false})
    .pipe(plugins.order(config.scriptOrder))
    .pipe(plugins.using({prefix: 'Injecting'})),
      { addRootSlash: false, ignorePath: config.basePaths.dest })
  )

  .pipe(plugins.size({title: 'templates', showFiles: true, gzip: true}))
  .pipe(gulp.dest(config.typePaths.templates.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());

});

gulp.task('styles', function() {
  return es.merge(

    gulp.src(config.typeMap.less, {cwd: config.typePaths.styles.src})
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())
    .pipe(plugins.less()),
 
    gulp.src(config.typeMap.css, {cwd: config.typePaths.styles.src}))
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())

  .pipe(isProduction ? plugins.csso() : gutil.noop())
  .pipe(plugins.order(config.styleOrder))
  .pipe(plugins.concat('app.min.css'))
  .pipe(plugins.size({title: 'styles', showFiles: true, gzip: true}))
  .pipe(gulp.dest(config.typePaths.styles.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('scripts', function() {
  return es.merge(
    es.merge(

      gulp.src(config.typeMap.coffee, {cwd: config.typePaths.scripts.src})
      // .pipe(plugins.watch())
      // .pipe(plugins.plumber())
      .pipe(plugins.coffee()),

      gulp.src(config.typeMap.js, {cwd: config.typePaths.scripts.src}))
      // .pipe(plugins.watch())
      // .pipe(plugins.plumber())

      .pipe(plugins.jshint())
      .pipe(plugins.jshint.reporter('default'))

      .pipe(isProduction ? plugins.uglify() : gutil.noop()),

    gulp.src(config.typeMap.jslibs, {cwd:config.typePaths.scripts.src}))
    .pipe(plugins.order(config.scriptOrder))
    .pipe(isProduction ? plugins.concat('app.min.js') : gutil.noop())
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())

  .pipe(plugins.size({title: 'scripts', showFiles: false, gzip: true}))
  .pipe(gulp.dest(config.typePaths.scripts.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('images', function() {
  return gulp.src(config.appFiles.images, {cwd: config.typePaths.images.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(isProduction ? plugins.imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }) : gutil.noop())
  .pipe(plugins.size({title: 'imagemin', showFiles: false}))
  .pipe(gulp.dest(config.typePaths.images.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('extras', function() {
  return gulp.src(config.appFiles.extras, {cwd: config.typePaths.extras.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(plugins.size({title: 'extras', showFiles: false}))
  .pipe(gulp.dest(config.typePaths.extras.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('bundle', function () {
  var date = new Date();
  var nicedate = date.toISOString().replace(/(\-|:|\.)/g, '');
  var archiveName = 'archive-'+ nicedate +'.zip';
  console.log(archiveName);
  return gulp.src(config.basePaths.dest + config.GLOBSTAR)
    .pipe(plugins.zip(archiveName))
    .pipe(plugins.size({title: 'Bundle', showFiles: true}))
    .pipe(gulp.dest(config.basePaths.src + '..'));
});


gulp.task('watch', function() {
  plugins.connect.server({
    livereload: true,
    port: config.SERVER_PORT,
    root: config.basePaths.dest
  });

  gulp.watch(config.typePaths.styles.src + config.GLOBSTAR, ['styles']);<commit_msg>Change bundle destination to parent directory<commit_after>var gulp    = require('gulp'),
    gutil   = require('gulp-util'),
    es      = require('event-stream');

var plugins = require('gulp-load-plugins')({
  camelize: true
});

var config = require('./gulpfile.config');

// Default values
var isProduction = false;

if(gutil.env.prod === true) {
    isProduction = true;
}

gulp.task('clean', function() {
  return gulp.src(config.basePaths.dest)
  .pipe(plugins.clean());
});

gulp.task('templates', ['scripts', 'styles'], function() {
  return gulp.src(config.appFiles.templates, {cwd: config.typePaths.templates.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(plugins.jade({ pretty: (isProduction ? false : true) }))

  .pipe(plugins.inject(
    gulp.src(config.typePaths.styles.dest + config.GLOBSTAR, {read: false})
    .pipe(plugins.order(config.styleOrder))
    .pipe(plugins.using({prefix: 'Injecting'})),
      { addRootSlash: false, ignorePath: config.basePaths.dest })
  )
  .pipe(plugins.inject(
    gulp.src(config.typePaths.scripts.dest + config.GLOBSTAR, {read: false})
    .pipe(plugins.order(config.scriptOrder))
    .pipe(plugins.using({prefix: 'Injecting'})),
      { addRootSlash: false, ignorePath: config.basePaths.dest })
  )

  .pipe(plugins.size({title: 'templates', showFiles: true, gzip: true}))
  .pipe(gulp.dest(config.typePaths.templates.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());

});

gulp.task('styles', function() {
  return es.merge(

    gulp.src(config.typeMap.less, {cwd: config.typePaths.styles.src})
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())
    .pipe(plugins.less()),
 
    gulp.src(config.typeMap.css, {cwd: config.typePaths.styles.src}))
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())

  .pipe(isProduction ? plugins.csso() : gutil.noop())
  .pipe(plugins.order(config.styleOrder))
  .pipe(plugins.concat('app.min.css'))
  .pipe(plugins.size({title: 'styles', showFiles: true, gzip: true}))
  .pipe(gulp.dest(config.typePaths.styles.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('scripts', function() {
  return es.merge(
    es.merge(

      gulp.src(config.typeMap.coffee, {cwd: config.typePaths.scripts.src})
      // .pipe(plugins.watch())
      // .pipe(plugins.plumber())
      .pipe(plugins.coffee()),

      gulp.src(config.typeMap.js, {cwd: config.typePaths.scripts.src}))
      // .pipe(plugins.watch())
      // .pipe(plugins.plumber())

      .pipe(plugins.jshint())
      .pipe(plugins.jshint.reporter('default'))

      .pipe(isProduction ? plugins.uglify() : gutil.noop()),

    gulp.src(config.typeMap.jslibs, {cwd:config.typePaths.scripts.src}))
    .pipe(plugins.order(config.scriptOrder))
    .pipe(isProduction ? plugins.concat('app.min.js') : gutil.noop())
    // .pipe(plugins.watch())
    // .pipe(plugins.plumber())

  .pipe(plugins.size({title: 'scripts', showFiles: false, gzip: true}))
  .pipe(gulp.dest(config.typePaths.scripts.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('images', function() {
  return gulp.src(config.appFiles.images, {cwd: config.typePaths.images.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(isProduction ? plugins.imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }) : gutil.noop())
  .pipe(plugins.size({title: 'imagemin', showFiles: false}))
  .pipe(gulp.dest(config.typePaths.images.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('extras', function() {
  return gulp.src(config.appFiles.extras, {cwd: config.typePaths.extras.src})
  // .pipe(plugins.watch())
  // .pipe(plugins.plumber())
  .pipe(plugins.size({title: 'extras', showFiles: false}))
  .pipe(gulp.dest(config.typePaths.extras.dest))
  .pipe(isProduction ? gutil.noop() : plugins.connect.reload());
});

gulp.task('bundle', function () {
  var date = new Date();
  var nicedate = date.toISOString().replace(/(\-|:|\.)/g, '');
  var archiveName = 'archive-'+ nicedate +'.zip';
  console.log(archiveName);
  return gulp.src(config.basePaths.dest + config.GLOBSTAR)
    .pipe(plugins.zip(archiveName))
    .pipe(plugins.size({title: 'Bundle', showFiles: true}))
    .pipe(gulp.dest('..'));
});


gulp.task('watch', function() {
  plugins.connect.server({
    livereload: true,
    port: config.SERVER_PORT,
    root: config.basePaths.dest
  });

  gulp.watch(config.typePaths.styles.src + config.GLOBSTAR, ['styles']);
{'fraction_non_alphanumeric': 0.19779371207942636, 'fraction_numerical': 0.0002206287920573635, 'mean_word_length': 3.9703947368421053, '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': '3974018', 'n_tokens_mistral': 3208, 'n_tokens_neox': 3115, 'n_words': 452}