<commit_before>'use strict';

var browserSync   = require('browser-sync');
var path          = require('path');
var scriptsModule = null;
var serverModule  = null;
var gulp          = null;

function isOnlyChange(event) {
  return event.type === 'changed';
}

function watchFiles (options){
  gulp.watch([options.src + '/*.html', 'bower.json'], ['inject']);


  gulp.watch([
    options.src + '/app/**/*.css',
    options.src + '/app/**/*.scss'
  ], function(event) {
    if(isOnlyChange(event)) {
      gulp.start('styles');
    } else {
      gulp.start('inject');
    }
  });

  gulp.watch([
    options.src + '/app/**/*.js',
    options.src + '/app/**/*.coffee'
  ], function(event) {
    if(isOnlyChange(event)) {
      var fullDest  = options.tmp + '/serve/' + path.relative(options.src, event.path).replace(/\.\.\//g, '');
      fullDest      = path.dirname( fullDest );
      scriptsModule.buildScripts({ src: event.path, dest: fullDest, buildOptions: options })
    } else {
      gulp.start('inject');
    }
  });

  gulp.watch(options.src + '/app/**/*.html', function(event) {
    if(serverModule.isEnabled){
      browserSync.reload(event.path);
    } else {
      gulp.start('templates:tmp');
    }
  });

  gulp.watch([
    options.src + '/app/**/*.cjsx',
  ], function(event) {
    if(isOnlyChange(event)) {
      var fullDest  = options.tmp + '/serve/' + path.relative(options.src, event.path).replace(/\.\.\//g, '');
      fullDest      = path.dirname( fullDest );
      scriptsModule.buildCJSX({ src: event.path, dest: fullDest, buildOptions: options })
    } else {
      gulp.start('inject');
    }
  });
}

module.exports = function(options) {

  scriptsModule = require(options.modulesData['scripts'].uses)(options);
  gulp          = require(options.modulesData['gulp'].uses);
  serverModule  = require(options.modulesData['server'].uses);
  var watchDeps = ['inject', 'fonts:tmp', 'other:tmp', 'templates:tmp', 'copyEnviroments:tmp'];

  !serverModule.isEnabled && watchDeps.push('bower:tmp');

<commit_msg>Criação de dependências da task watch de forma dinâmica<commit_after>'use strict';

var browserSync   = require('browser-sync');
var path          = require('path');
var scriptsModule = null;
var serverConfig  = null;
var gulp          = null;

function isOnlyChange(event) {
  return event.type === 'changed';
}

function watchFiles (options){
  gulp.watch([options.src + '/*.html', 'bower.json'], ['inject']);


  gulp.watch([
    options.src + '/app/**/*.css',
    options.src + '/app/**/*.scss'
  ], function(event) {
    if(isOnlyChange(event)) {
      gulp.start('styles');
    } else {
      gulp.start('inject');
    }
  });

  gulp.watch([
    options.src + '/app/**/*.js',
    options.src + '/app/**/*.coffee'
  ], function(event) {
    if(isOnlyChange(event)) {
      var fullDest  = options.tmp + '/serve/' + path.relative(options.src, event.path).replace(/\.\.\//g, '');
      fullDest      = path.dirname( fullDest );
      scriptsModule.buildScripts({ src: event.path, dest: fullDest, buildOptions: options })
    } else {
      gulp.start('inject');
    }
  });

  gulp.watch(options.src + '/app/**/*.html', function(event) {
    if(serverConfig.isEnabled){
      browserSync.reload(event.path);
    } else {
      gulp.start('templates:tmp');
    }
  });

  gulp.watch([
    options.src + '/app/**/*.cjsx',
  ], function(event) {
    if(isOnlyChange(event)) {
      var fullDest  = options.tmp + '/serve/' + path.relative(options.src, event.path).replace(/\.\.\//g, '');
      fullDest      = path.dirname( fullDest );
      scriptsModule.buildCJSX({ src: event.path, dest: fullDest, buildOptions: options })
    } else {
      gulp.start('inject');
    }
  });
}

module.exports = function(options) {

  scriptsModule = require(options.modulesData['scripts'].uses)(options);
  gulp          = require(options.modulesData['gulp'].uses);
  serverConfig  = options.modulesData['server'];
  var watchDeps = ['inject'];

  if(!serverConfig.isEnabled){
    watchDeps = watchDeps.concat(['bower:tmp', 'fonts:tmp', 'other:tmp', 'templates:tmp', 'copyEnviroments:tmp']);
  };

{'fraction_non_alphanumeric': 0.19509232264334306, 'fraction_numerical': 0.0, 'mean_word_length': 3.0641658440276407, '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': '1944205', 'n_tokens_mistral': 1371, 'n_tokens_neox': 1352, 'n_words': 231}