<commit_before>path       = require 'path'
gulp       = require 'gulp'
gutil      = require 'gulp-util'
jade       = require 'gulp-jade'
stylus     = require 'gulp-stylus'
CSSmin     = require 'gulp-minify-css'
browserify = require 'browserify'
watchify   = require 'watchify'
source     = require 'vinyl-source-stream'
streamify  = require 'gulp-streamify'
rename     = require 'gulp-rename'
uglify     = require 'gulp-uglify'
coffeeify  = require 'coffeeify'
nodeStatic = require 'node-static'
lr         = require 'tiny-lr'
livereload = require 'gulp-livereload'
plumber    = require 'gulp-plumber'
prefix     = require 'gulp-autoprefixer'
reloadServer = lr()

production = process.env.NODE_ENV is 'production'

gulp.task 'coffee', ->

  bundle = watchify('./src/coffee/main.coffee')

  rebundle = ->

    build = bundle.bundle(debug: not production)
      .pipe(source('bundle.js'))

    build.pipe(streamify(uglify())) if production

    build
      .pipe(gulp.dest('./public/js/'))
      .pipe(livereload(reloadServer))

  bundle.on 'update', rebundle unless production

  rebundle()

gulp.task 'jade', ->
  gulp
    .src('src/jade/*.jade')
    .pipe(jade(pretty: not production))
    .pipe(gulp.dest('public/'))
    .pipe livereload(reloadServer)

gulp.task 'stylus', ->
  styles = gulp
    .src('src/stylus/style.styl')
    .pipe(stylus({set: ['include css']}))
    .pipe(prefix("last 1 version", "> 1%", "ie 8"))

  styles.pipe(CSSmin()) if production

  styles.pipe(gulp.dest('public/css/'))
    .pipe livereload reloadServer

gulp.task 'assets', ->
  gulp
    .src('src/assets/**/*.*')
    .pipe gulp.dest 'public/'

gulp.task "server", ->
  staticFiles = new nodeStatic.Server './public'
  require('http').createServer (req, res) ->
    req.addListener 'end', ->
      staticFiles.serve req, res
    req.resume()
  .listen 9001

gulp.task "watch", ->
  reloadServer.listen 35729, (err) ->
    console.error err if err?

    gulp.watch "src/jade/*.jade", ["jade"]
    gulp.watch "src/stylus/*.styl", ["stylus"]
    gulp.watch "src/assets/**/*.*", ["assets"]

gulp.task "build", ["coffee", "jade", "stylus", "assets"]
gulp.task "default", ["build", "watch", "server"]
<commit_msg>move watchify under watch task<commit_after>path       = require 'path'
gulp       = require 'gulp'
gutil      = require 'gulp-util'
jade       = require 'gulp-jade'
stylus     = require 'gulp-stylus'
CSSmin     = require 'gulp-minify-css'
browserify = require 'browserify'
watchify   = require 'watchify'
source     = require 'vinyl-source-stream'
streamify  = require 'gulp-streamify'
rename     = require 'gulp-rename'
uglify     = require 'gulp-uglify'
coffeeify  = require 'coffeeify'
nodeStatic = require 'node-static'
lr         = require 'tiny-lr'
livereload = require 'gulp-livereload'
plumber    = require 'gulp-plumber'
prefix     = require 'gulp-autoprefixer'
reloadServer = lr()

production = process.env.NODE_ENV is 'production'

gulp.task 'coffee', ->

  bundle = browserify('./src/coffee/main.coffee')

  build = bundle.bundle(debug: not production)
    .pipe(source('bundle.js'))

  build.pipe(streamify(uglify())) if production

  build
    .pipe(gulp.dest('./public/js/'))

gulp.task 'jade', ->
  gulp
    .src('src/jade/*.jade')
    .pipe(jade(pretty: not production))
    .pipe(gulp.dest('public/'))
    .pipe livereload(reloadServer)

gulp.task 'stylus', ->
  styles = gulp
    .src('src/stylus/style.styl')
    .pipe(stylus({set: ['include css']}))
    .pipe(prefix("last 1 version", "> 1%", "ie 8"))

  styles.pipe(CSSmin()) if production

  styles.pipe(gulp.dest('public/css/'))
    .pipe livereload reloadServer

gulp.task 'assets', ->
  gulp
    .src('src/assets/**/*.*')
    .pipe gulp.dest 'public/'

gulp.task "server", ->
  staticFiles = new nodeStatic.Server './public'
  require('http').createServer (req, res) ->
    req.addListener 'end', ->
      staticFiles.serve req, res
    req.resume()
  .listen 9001

gulp.task "watch", ->
  reloadServer.listen 35729

  gulp.watch "src/jade/*.jade", ["jade"]
  gulp.watch "src/stylus/*.styl", ["stylus"]
  gulp.watch "src/assets/**/*.*", ["assets"]

  bundle = watchify('./src/coffee/main.coffee')

  bundle.on 'update', ->
    build = bundle.bundle(debug: not production)
      .pipe(source('bundle.js'))

    build
      .pipe(gulp.dest('./public/js/'))
      .pipe(livereload(reloadServer))

  .emit 'update'

gulp.task "build", ["coffee", "jade", "stylus", "assets"]
gulp.task "default", ["build", "watch", "server"]

{'fraction_non_alphanumeric': 0.1738355248495654, 'fraction_numerical': 0.005348785379986628, 'mean_word_length': 3.2988505747126435, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, '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': '1823162', 'n_tokens_mistral': 1659, 'n_tokens_neox': 1591, 'n_words': 337}