<commit_before>fs      = require 'fs'
gulp    = require 'gulp'
argv    = require('minimist') process.argv
nodemon = require 'gulp-nodemon'
req     = (module) -> require "./gulptasks/#{module}"

# CONSTANTS

SERVER_FILE = "./server/server.coffee"
SERVER_PATH = ["./server/**/*.coffee"]


# HELPERS

{watchLogger, log} = req 'helper.logger'


# BUILD SERVER

gulp.task 'serve', ['build'], -> server = nodemon script: SERVER_FILE


# WATCHERS

gulp.task 'watch-server', -> watchLogger 'cyan', gulp.watch SERVER_PATH, ['serve']


# BUILD

gulp.task 'build', ->

  folders = (folder for folder in fs.readdirSync('./') when fs.statSync(folder).isDirectory())
  sites   = folders.filter (folder) -> folder.search(/^site\./) is 0

  console.log sites

gulp.task 'default', ['build', 'serve'], ->


# ERROR HANDLING

process.on 'uncaughtException', (err)->

  log 'red', "#{err.name}: #{err.message}"
  # console.error err<commit_msg>Build: made main gulp produce sites<commit_after>fs      = require 'fs'
gulp    = require 'gulp'
argv    = require('minimist') process.argv
nodemon = require 'gulp-nodemon'
shell   = require 'gulp-shell'
req     = (module) -> require "./gulptasks/#{module}"

# CONSTANTS

SERVER_FILE = "./server/server.coffee"
SERVER_PATH = ["./server/**/*.coffee"]


# HELPERS

{watchLogger, log} = req 'helper.logger'


# BUILD SERVER

gulp.task 'serve', ['build'], -> server = nodemon script: SERVER_FILE


# WATCHERS

gulp.task 'watch-server', -> watchLogger 'cyan', gulp.watch SERVER_PATH, ['serve']


# BUILD

gulp.task 'build', ->

  folders  = (folder for folder in fs.readdirSync('./') when fs.statSync(folder).isDirectory())
  sites    = folders.filter (folder) -> folder.search(/^site\./) is 0
  commands = ("gulp --gulpfile ./#{site}/gulpfile.coffee build --site=#{site}" for site in sites)

  gulp.src ''
    .pipe shell commands



gulp.task 'default', ['build', 'serve'], ->


# ERROR HANDLING

process.on 'uncaughtException', (err)->

  log 'red', "#{err.name}: #{err.message}"
  # console.error err
{'fraction_non_alphanumeric': 0.1808300395256917, 'fraction_numerical': 0.0009881422924901185, 'mean_word_length': 3.7093023255813953, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '7033526', 'n_tokens_mistral': 737, 'n_tokens_neox': 704, 'n_words': 173}