<commit_before>import { config, path, fs } from 'azk';
import h from 'spec/spec_helper';
import { Generator } from 'azk/generator';
import { Manifest } from 'azk/manifest';

describe("Azk generator ruby rule", function() {
  var project = null;
  var name    = null;
  var outputs = [];
  var UI  = h.mockUI(beforeEach, outputs);
  var generator = new Generator(UI);

  before(function() {
    return h.tmp_dir().then((dir) => {
      project = dir;
      name    = path.basename(dir);
    });
  });

  var generateAndReturnManifest = (project) => {
    var manifest = path.join(project, config('manifest'));
    generator.render({
      systems: generator.findSystems(project),
    }, manifest);
    return new Manifest(project);
  }

  it("should detect single node system", function() {
    h.touchSync(path.join(project, "Gemfile"));
    var manifest = generateAndReturnManifest(project);
    var system   = manifest.systemDefault;

    h.expect(system).to.have.deep.property("name", name);
    h.expect(system).to.have.deep.property("image.name", "dockerfile/ruby:latest");
    h.expect(system).to.have.deep.property("depends").and.to.eql([]);
    h.expect(system).to.have.deep.property("options.workdir", "/azk/" + name);
    h.expect(system).to.have.deep.property("options.mount_folders")
      .and.to.eql({ ".": "/azk/" + name });
    h.expect(system).to.have.deep.property("options.command")
      .and.to.eql("rackup -c config.ru --port $PORT");
    h.expect(system).to.have.deep.property("options.provision")
      .and.to.eql(["bundle install --path vendor/bundler"]);
  });

  it("should detect sub-system", function() {
    var sub = path.join(project, "sub");
    fs.mkdirSync(sub);
    h.touchSync(path.join(sub, "Gemfile"));

    var manifest = generateAndReturnManifest(project);
    var system   = manifest.system("sub");

    h.expect(system).to.have.deep.property("name", "sub");
    h.expect(system).to.have.deep.property("options.workdir", "/azk/" + name + "/sub");
  });
});<commit_msg>Fixing rule ruby spec.<commit_after>import { config, path, fs } from 'azk';
import h from 'spec/spec_helper';
import { Generator } from 'azk/generator';
import { Manifest } from 'azk/manifest';

describe("Azk generator ruby rule", function() {
  var project = null;
  var name    = null;
  var outputs = [];
  var UI  = h.mockUI(beforeEach, outputs);
  var generator = new Generator(UI);

  before(function() {
    return h.tmp_dir().then((dir) => {
      project = dir;
      name    = path.basename(dir);
    });
  });

  var generateAndReturnManifest = (project) => {
    var manifest = path.join(project, config('manifest'));
    generator.render({
      systems: generator.findSystems(project),
    }, manifest);
    return new Manifest(project);
  }

  it("should detect single node system", function() {
    h.touchSync(path.join(project, "Gemfile"));
    var manifest = generateAndReturnManifest(project);
    var system   = manifest.systemDefault;

    h.expect(system).to.have.deep.property("name", name);
    h.expect(system).to.have.deep.property("image.name", "dockerfile/ruby:latest");
    h.expect(system).to.have.deep.property("depends").and.to.eql([]);
    h.expect(system).to.have.deep.property("options.workdir", "/azk/" + name);
    h.expect(system).to.have.deep.property("options.mount_folders")
      .and.to.eql({ ".": "/azk/" + name });
    h.expect(system).to.have.deep.property("options.command")
      .and.to.eql("bundle exec rackup config.ru --port $PORT");
    h.expect(system).to.have.deep.property("options.provision")
      .and.to.eql(["bundle install --path vendor/bundler"]);
  });

  it("should detect sub-system", function() {
    var sub = path.join(project, "sub");
    fs.mkdirSync(sub);
    h.touchSync(path.join(sub, "Gemfile"));

    var manifest = generateAndReturnManifest(project);
    var system   = manifest.system("sub");

    h.expect(system).to.have.deep.property("name", "sub");
    h.expect(system).to.have.deep.property("options.workdir", "/azk/" + name + "/sub");
  });
});
{'fraction_non_alphanumeric': 0.18316831683168316, 'fraction_numerical': 0.0, 'mean_word_length': 3.6501726121979288, 'pattern_counts': {'":': 2, '<': 3, '<?xml version=': 0, '>': 7, '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': '7299787', 'n_tokens_mistral': 1335, 'n_tokens_neox': 1308, 'n_words': 244}