<commit_before>// Generated by CoffeeScript 1.3.3
(function() {
  var Hem, argv, compilers, css, fs, help, optimist, path, pkg, specs, strata;

  path = require('path');

  fs = require('fs');

  optimist = require('optimist');

  strata = require('strata');

  compilers = require('./compilers');

  pkg = require('./package');

  css = require('./css');

  specs = require('./specs');

  argv = optimist.usage(['  usage: hem COMMAND', '    server  start a dynamic development server', '    build   serialize application to disk', '    watch   build & watch disk for changes'].join("\n")).alias('p', 'port').alias('d', 'debug').argv;

  help = function() {
    optimist.showHelp();
    return process.exit();
  };

  Hem = (function() {

    Hem.exec = function(command, options) {
      return (new this(options)).exec(command);
    };

    Hem.include = function(props) {
      var key, value, _results;
      _results = [];
      for (key in props) {
        value = props[key];
        _results.push(this.prototype[key] = value);
      }
      return _results;
    };

    Hem.prototype.compilers = compilers;

    Hem.prototype.options = {
      slug: './slug.json',
      css: './css',
      libs: [],
      "public": './public',
      paths: ['./app'],
      dependencies: [],
      port: process.env.PORT || argv.port || 9294,
      cssPath: '/application.css',
      jsPath: '/application.js',
      test: './test',
      testPublic: './test/public',
      testPath: '/test',
      specs: './test/specs',
      specsPath: '/specs.js'
    };

    function Hem(options) {
      var key, value, _ref;
      if (options == null) {
        options = {};
      }
      for (key in options) {
        value = options[key];
        this.options[key] = value;
      }
      _ref = this.readSlug();
      for (key in _ref) {
        value = _ref[key];
        this.options[key] = value;
      }
    }

    Hem.prototype.server = function() {
      var _this = this;
      strata.use(strata.contentLength);
      strata.get(this.options.cssPath, this.cssPackage().createServer());
      strata.get(this.options.jsPath, this.hemPackage().createServer());
      strata.map(this.options.testPath, function(app) {
        if (path.existsSync(_this.options.specs)) {
          app.get(_this.options.specsPath, _this.specsPackage().createServer());
        }
        if (path.existsSync(_this.options.testPublic)) {
          return app.use(strata.file, _this.options.testPublic, ['index.html', 'index.htm']);
        }
      });
      if (path.existsSync(this.options["public"])) {
        strata.use(strata.file, this.options["public"], ['index.html', 'index.htm']);
      }
      return strata.run({
        port: this.options.port
      });
    };

    Hem.prototype.build = function() {
      var source;
      source = this.hemPackage().compile(!argv.debug);
      fs.writeFileSync(path.join(this.options["public"], this.options.jsPath), source);
      source = this.cssPackage().compile();
      return fs.writeFileSync(path.join(this.options["public"], this.options.cssPath), source);
    };

    Hem.prototype.watch = function() {
      var dir, lib, _i, _len, _ref, _results,
        _this = this;
      this.build();
      _ref = ((function() {
        var _j, _len, _ref, _results1;
        _ref = this.options.libs;
        _results1 = [];
        for (_j = 0, _len = _ref.length; _j < _len; _j++) {
          lib = _ref[_j];
          _results1.push(path.dirname(lib));
        }
        return _results1;
      }).call(this)).concat(this.options.css, this.options.paths);
      _results = [];
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        dir = _ref[_i];
        if (!path.existsSync(dir)) {
          continue;
        }
        _results.push(require('watch').watchTree(dir, function(file, curr, prev) {
          if (curr && (curr.nlink === 0 || +curr.mtime !== +(prev != null ? prev.mtime : void 0))) {
            console.log("" + file + " changed.  Rebuilding.");
            return _this.build();
          }
        }));
      }
      return _results;
    };

    Hem.prototype.exec = function(command) {
      if (command == null) {
        command = argv._[0];
      }
      if (!this[command]) {
        return help();
      }
      this[command]();
      switch (command) {
        case 'build':
          return console.log('Built application');
        case 'watch':
          return console.log('Watching application');
      }
    };

    Hem.prototype.readSlug = function(slug) {
      if (slug == null) {
        slug = this.options.slug;
      }
      if (!(slug && path.existsSync(slug))) {
        return {};
      }
      return JSON.parse(fs.readFileSync(slug, 'utf-8'));
    };

    Hem.prototype.cssPackage = function() {
      return css.createPackage(this.options.css);<commit_msg>compiled<commit_after>// Generated by CoffeeScript 1.3.3
(function() {
  var Hem, argv, compilers, css, fs, help, optimist, path, pkg, specs, strata;

  path = require('path');

  fs = require('fs');

  optimist = require('optimist');

  strata = require('strata');

  compilers = require('./compilers');

  pkg = require('./package');

  css = require('./css');

  specs = require('./specs');

  argv = optimist.usage(['  usage: hem COMMAND', '    server  start a dynamic development server', '    build   serialize application to disk', '    watch   build & watch disk for changes'].join("\n")).alias('p', 'port').alias('d', 'debug').argv;

  help = function() {
    optimist.showHelp();
    return process.exit();
  };

  Hem = (function() {

    Hem.exec = function(command, options) {
      return (new this(options)).exec(command);
    };

    Hem.include = function(props) {
      var key, value, _results;
      _results = [];
      for (key in props) {
        value = props[key];
        _results.push(this.prototype[key] = value);
      }
      return _results;
    };

    Hem.prototype.compilers = compilers;

    Hem.prototype.options = {
      slug: './slug.json',
      css: './css',
      libs: [],
      "public": './public',
      paths: ['./app'],
      dependencies: [],
      port: process.env.PORT || argv.port || 9294,
      cssPath: '/application.css',
      jsPath: '/application.js',
      test: './test',
      testPublic: './test/public',
      testPath: '/test',
      specs: './test/specs',
      specsPath: '/test/specs.js'
    };

    function Hem(options) {
      var key, value, _ref;
      if (options == null) {
        options = {};
      }
      for (key in options) {
        value = options[key];
        this.options[key] = value;
      }
      _ref = this.readSlug();
      for (key in _ref) {
        value = _ref[key];
        this.options[key] = value;
      }
    }

    Hem.prototype.server = function() {
      var _this = this;
      strata.use(strata.contentLength);
      strata.map(this.options.cssPath, function(app) {
        return app.run(_this.cssPackage().createServer());
      });
      strata.map(this.options.jsPath, function(app) {
        return app.run(_this.hemPackage().createServer());
      });
      if (fs.existsSync(this.options.specs)) {
        strata.map(this.options.specsPath, function(app) {
          return app.run(_this.specsPackage().createServer());
        });
      }
      if (fs.existsSync(this.options.testPublic)) {
        strata.map(this.options.testPath, function(app) {
          return app.use(strata.file, _this.options.testPublic, ['index.html', 'index.htm']);
        });
      }
      if (fs.existsSync(this.options["public"])) {
        strata.use(strata.file, this.options["public"], ['index.html', 'index.htm']);
      }
      return strata.run({
        port: this.options.port
      });
    };

    Hem.prototype.build = function() {
      var source;
      source = this.hemPackage().compile(!argv.debug);
      fs.writeFileSync(path.join(this.options["public"], this.options.jsPath), source);
      source = this.cssPackage().compile();
      return fs.writeFileSync(path.join(this.options["public"], this.options.cssPath), source);
    };

    Hem.prototype.watch = function() {
      var dir, lib, _i, _len, _ref, _results,
        _this = this;
      this.build();
      _ref = ((function() {
        var _j, _len, _ref, _results1;
        _ref = this.options.libs;
        _results1 = [];
        for (_j = 0, _len = _ref.length; _j < _len; _j++) {
          lib = _ref[_j];
          _results1.push(path.dirname(lib));
        }
        return _results1;
      }).call(this)).concat(this.options.css, this.options.paths);
      _results = [];
      for (_i = 0, _len = _ref.length; _i < _len; _i++) {
        dir = _ref[_i];
        if (!fs.existsSync(dir)) {
          continue;
        }
        _results.push(require('watch').watchTree(dir, function(file, curr, prev) {
          if (curr && (curr.nlink === 0 || +curr.mtime !== +(prev != null ? prev.mtime : void 0))) {
            console.log("" + file + " changed.  Rebuilding.");
            return _this.build();
          }
        }));
      }
      return _results;
    };

    Hem.prototype.exec = function(command) {
      if (command == null) {
        command = argv._[0];
      }
      if (!this[command]) {
        return help();
      }
      this[command]();
      switch (command) {
        case 'build':
          return console.log('Built application');
        case 'watch':
          return console.log('Watching application');
      }
    };

    Hem.prototype.readSlug = function(slug) {
      if (slug == null) {
        slug = this.options.slug;
      }
      if (!(slug && fs.existsSync(slug))) {
        return {};
      }
      return JSON.parse(fs.readFileSync(slug, 'utf-8'));
    };

    Hem.prototype.cssPackage = function() {
      return css.createPackage(this.options.css);
{'fraction_non_alphanumeric': 0.16916488222698073, 'fraction_numerical': 0.0034669113898235953, 'mean_word_length': 2.1958292603453895, 'pattern_counts': {'":': 2, '<': 7, '<?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': '2161851', 'n_tokens_mistral': 3117, 'n_tokens_neox': 3069, 'n_words': 625}