<commit_before>/* global require */

var gulp = require('gulp');
var spawn = require('child_process').spawn;
var ember, node, mocha;
var installs = [];

var NODE_PORT = 3900,
    EMBER_PORT = 4900;


gulp.task('node', function () {
  if (node) node.kill();  // Kill server if one is running
  process.env.PORT = NODE_PORT;
  node = spawn('node', ['node/index.js'], {stdio: 'inherit'});
  node.on('close', function (code) {
    if (code === 8) {
      console.log('Node error detected, waiting for changes...');
    }
  });
});

gulp.task('ember', function () {
  process.env.API_URL = "http://localhost:" + NODE_PORT + "/";
  ember = spawn('./node_modules/.bin/ember', ['server', '--port=' + EMBER_PORT,], {cwd: 'ember', stdio: 'inherit'});
  ember.on('close', function (code) {
    if (code === 8) {
      console.log('Ember error detected, waiting for changes...');
    }
  });
});


gulp.task('install', function () {
  installs.push(spawn('npm', ['install'], {cwd: 'ember', stdio: 'inherit'}));
  installs.push(spawn('bower', ['install'], {cwd: 'ember', stdio: 'inherit'}));
  installs.push(spawn('npm', ['install'], {stdio: 'inherit'}));
});


gulp.task('test', function () {
  process.env.NODE_ENV = 'test';
  mocha = spawn('./node_modules/mocha/bin/mocha', ['node/tests', '--require=node/index.js'], {stdio: 'inherit'});
});


gulp.task('default', function () {
  gulp.run('node');
  gulp.run('ember');

  // Reload node if files changed
  gulp.watch(['node/**/*.js'], function () {
    gulp.run('node');
  });
});


// kill node server on exit
process.on('exit', function() {
    if (node) node.kill();
    if (ember) ember.kill();
    if (mocha) mocha.kill();
    installs.forEach(function (install) { install.kill(); });
});<commit_msg>Move gulpfile from Node to Django<commit_after>/* global require */

var gulp = require('gulp');
var spawn = require('child_process').spawn;
var ember, django, mocha;
var installs = [];

var DJANGO_PORT = 3900,
    EMBER_PORT = 4900;


gulp.task('django', function () {
  if (django) django.kill();  // Kill server if one is running
  django = spawn('./django/manage.py', ['runserver', DJANGO_PORT], {stdio: 'inherit'});
  django.on('close', function (code) {
    if (code === 8) {
      console.log('Django error detected, waiting for changes...');
    }
  });
});

gulp.task('ember', function () {
  process.env.API_URL = "http://localhost:" + DJANGO_PORT + "/";
  ember = spawn('./node_modules/.bin/ember', ['server', '--port=' + EMBER_PORT,], {cwd: 'ember', stdio: 'inherit'});
  ember.on('close', function (code) {
    if (code === 8) {
      console.log('Ember error detected, waiting for changes...');
    }
  });
});


gulp.task('install', function () {
  installs.push(spawn('npm', ['install'], {cwd: 'ember', stdio: 'inherit'}));
  installs.push(spawn('bower', ['install'], {cwd: 'ember', stdio: 'inherit'}));
  installs.push(spawn('npm', ['install'], {stdio: 'inherit'}));
});


gulp.task('test', function () {
  process.env.DJANGO_ENV = 'test';
  mocha = spawn('./django/manage.py', ['test'], {stdio: 'inherit'});
});


gulp.task('default', function () {
  gulp.run('test');
});


// kill servers on exit
process.on('exit', function() {
    if (django) django.kill();
    if (ember) ember.kill();
    if (mocha) mocha.kill();
    installs.forEach(function (install) { install.kill(); });
});
{'fraction_non_alphanumeric': 0.2293221857270827, 'fraction_numerical': 0.005971931919976112, 'mean_word_length': 3.926470588235294, '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': '1939585', 'n_tokens_mistral': 1207, 'n_tokens_neox': 1165, 'n_words': 263}