<commit_before>debug = require('debug') 'spinacia:server'

global.Conf = require('yaml-config').readConfig './config/app.yaml'
Util = require './modules/util'
Api = require './modules/api'

uuid = require 'node-uuid'
spawn = require('child-process-promise').spawn
morgan = require 'morgan'
basicAuth = require 'basic-auth'
bodyParser = require 'body-parser'

REDIS_URL = process.env.REDIS_URL or 'redis://localhost'

kue = require('kue')
global.queue = kue.createQueue
   disableSearch: no
   redis: REDIS_URL

popeye = process.env.POPEYE_BINARY or Conf.popeye

queue.process 'popeye', 3, (job, done) ->
   any = (x) ->
      done null, x

   spawn popeye, [], capture: ['stdout', 'stderr']
      .then any, any, (cp) ->
         # input = job.data.input.replace /^\s*begi\w*\s/i, 'Begin Opti NoBoard '
         input = job.data.input

         cp.stdin.end input

params = port: (process.env.PORT or 5000)

require('zappajs') params, ->

   RedisStore = require('connect-redis')(@session)

   # @disable 'minify'
   @use morgan 'dev'
   # @use bodyParser.json type: Conf.contentType
   @use static: __dirname + '/public'
   @use session: secret: 'south', resave: no, saveUninitialized: no, store: new RedisStore()

   @get '/', -> @render 'index.blade'

   @get '/olive', ->  @render 'olive.blade'

   # @use @wrap ->
   #    @res.header 'Content-Type', Conf.contentType
   #    @next()

   @client '/main.js': ->
      @connect()

      @on 'disconnect', (socket) ->
         console.log 'Server is gone'

      @on solved: ->
         $('#error').hide()
         $('#solution').show().text @data.stdout

      @on queued: ->
         $('#error').hide()<commit_msg>/status<commit_after>debug = require('debug') 'spinacia:server'

global.Conf = require('yaml-config').readConfig './config/app.yaml'
Util = require './modules/util'
Api = require './modules/api'

uuid = require 'node-uuid'
spawn = require('child-process-promise').spawn
morgan = require 'morgan'
basicAuth = require 'basic-auth'
bodyParser = require 'body-parser'

REDIS_URL = process.env.REDIS_URL or 'redis://localhost'

kue = require('kue')
global.queue = kue.createQueue
   disableSearch: no
   redis: REDIS_URL

popeye = process.env.POPEYE_BINARY or Conf.popeye

queue.process 'popeye', 3, (job, done) ->
   any = (x) ->
      done null, x

   spawn popeye, [], capture: ['stdout', 'stderr']
      .then any, any, (cp) ->
         # input = job.data.input.replace /^\s*begi\w*\s/i, 'Begin Opti NoBoard '
         input = job.data.input

         cp.stdin.end input

params = port: (process.env.PORT or 5000)

require('zappajs') params, ->

   RedisStore = require('connect-redis')(@session)

   # @disable 'minify'
   @use morgan 'dev'
   # @use bodyParser.json type: Conf.contentType
   @use static: __dirname + '/public'
   @use session: secret: 'south', resave: no, saveUninitialized: no, store: new RedisStore()

   @get '/', -> @render 'index.blade'

   @get '/olive', ->  @render 'olive.blade'

   @use @wrap ->
      @res.header 'Content-Type', Conf.contentType
      @next()

   @get '/status', ->
      @jsonp status: 'ok'


   @client '/main.js': ->
      @connect()

      @on 'disconnect', (socket) ->
         console.log 'Server is gone'

      @on solved: ->
         $('#error').hide()
         $('#solution').show().text @data.stdout

      @on queued: ->
         $('#error').hide()
{'fraction_non_alphanumeric': 0.17467378410438908, 'fraction_numerical': 0.0029655990510083037, 'mean_word_length': 2.9312354312354314, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 26, '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': '4350444', 'n_tokens_mistral': 1184, 'n_tokens_neox': 1149, 'n_words': 274}