<commit_before>var spawn = require('child_process').spawn;
var path = require('path');

var Promise = require('bluebird');
var rimraf = require('rimraf');
var freight = require('freight')();

module.exports = function (log, conf, jobs) {
  function Tracker() {
  }

  jobs.promote();

  jobs.process('check_repository', 1, function (job, done) {
    var repository = job.data.repository;
    var branch = job.data.branch;

    log.debug('Calling creates');

    return fetchRepository(repository, branch)
      .then(function (projectDirectory) {
        var options = {
          // TODO: http(s)
          url: 'http://' + conf.get('ip') + ':' + conf.get('port') + '/',
          action: 'create',
          server: true,
          log: log,
          directory: projectDirectory,
          verbose: true
        };
        return freight.init(options)
          .then(
            function () {
              return new Promise(function (resolve, reject) {
                rimraf(projectDirectory, function (err) {
                  if (err) {
                    return reject(err);
                  }
                  log.debug('Directory Clean:', projectDirectory);
                  return resolve();
                });
              });
            }
          );
      })
      .then(
        function() {
          console.log('setting up another job');
          jobs.create('check_repository', { title: repository })
            .delay(conf.get('track').delay)
            .save();

          done();
        },
        function (err) {
          log.error(err);
          done(err);
        }
      );

  });

  Tracker.create = function (repository, branch, callback) {
    log.debug('Calling create');
    var job = jobs.create('check_repository', {
      title: repository + '_' + branch,
      repository: repository,
      branch: branch
    })
      .save();
<commit_msg>Add names for tracked repos<commit_after>var spawn = require('child_process').spawn;
var path = require('path');

var Promise = require('bluebird');
var rimraf = require('rimraf');
var freight = require('freight')();

module.exports = function (log, conf, jobs) {
  function Tracker() {
  }

  jobs.promote();

  jobs.process('check_repository', 1, function (job, done) {
    var repository = job.data.repository;
    var branch = job.data.branch;

    log.debug('Calling creates');

    return fetchRepository(repository, branch)
      .then(function (projectDirectory) {
        var options = {
          // TODO: http(s)
          url: 'http://' + conf.get('ip') + ':' + conf.get('port') + '/',
          action: 'create',
          server: true,
          log: log,
          directory: projectDirectory,
          verbose: true
        };
        return freight.init(options)
          .then(
            function () {
              return new Promise(function (resolve, reject) {
                rimraf(projectDirectory, function (err) {
                  if (err) {
                    return reject(err);
                  }
                  log.debug('Directory Clean:', projectDirectory);
                  return resolve();
                });
              });
            }
          );
      })
      .then(
        function() {
          console.log('setting up another job');
          var job = jobs.create('check_repository', {
            title: repository + '_' + branch,
            repository: repository,
            branch: branch
          })
            .delay(conf.get('track').delay)
            .save();

          done();
        },
        function (err) {
          log.error(err);
          done(err);
        }
      );

  });

  Tracker.create = function (repository, branch, callback) {
    log.debug('Calling create');
    var job = jobs.create('check_repository', {
      title: repository + '_' + branch,
      repository: repository,
      branch: branch
    })
      .save();

{'fraction_non_alphanumeric': 0.13832779340322168, 'fraction_numerical': 0.0005113781641523907, 'mean_word_length': 1.7166666666666666, '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': '4175525', 'n_tokens_mistral': 1059, 'n_tokens_neox': 1018, 'n_words': 239}