<commit_before>var selftest = require('../selftest.js');
var Sandbox = selftest.Sandbox;
var files = require('../files.js');
var catalog = require('../catalog.js');
var packageLoader = require("../package-loader.js");

// XXX: Why is this an internet using test? Because our warehouse is a
// hackhackhack. If we clean up the hackhackhackhack, then this does not need
// the internets. (Or, to be more specific: our warehouse code tries to fetch
// the packages from the internet. If we could fool it into using local packages
// instead, or think that it alreayd has the packages, it would be ok). (This is
// because it calls 'create' from a warehouse, to be specific).
selftest.define("springboard", ['checkout', 'net'], function () {
  var s = new Sandbox({
    warehouse: {
      v1: { },
      v2: { recommended: true }
    }
  });
  var run;

  var toolsPackage;
  selftest.doOrThrow(function() {
      toolsPackage = selftest.getToolsPackage();
  });
  var toolsVersion = toolsPackage.name + '@' +
        toolsPackage.version;

  // If run not in an app dir, runs the latest version ...
  run = s.run("--long-version");
  run.read('METEOR@v2\n' + toolsVersion + '\n');
  run.expectEnd();
  run.expectExit(0);

  // ... unless you asked for a different one.
  run = s.run("--long-version", "--release", "METEOR@v1");
  run.read('METEOR@v1\n' + toolsVersion + '\n');
  run.expectEnd();
  run.expectExit(0);

  // Apps are created with the latest release ...
  run = s.run("create", "myapp");
  run.waitSecs(5);
  run.expectExit(0);
  s.cd('myapp', function () {
    run = s.run("--long-version");
    run.read('METEOR@v2\n' + toolsVersion + '\n');
    run.expectExit(0);
  });

  // ... unless you asked for a different one.
  run = s.run("create", "myapp2", "--release", "METEOR@v1").expectExit(0);
  s.cd('myapp2', function () {
    run = s.run("--long-version");
    run.read('METEOR@v1\n' + toolsVersion + '\n');
    run.expectExit(0);
  });

  // Suppose you ask for a release that doesn't exist.
  s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'not-found');
  run = s.run("--release", "weird");
  run.readErr("weird: unknown release.\n");
  run.expectEnd();
  run.expectExit(1);

  // Suppose you're offline and you ask for a release you don't have
  // cached.
  // XXX On the refreshpolicy branch, we removed some of the support
  // code for this test. Make sure we get it to pass before merging.
  s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
  run = s.run("--release", "weird");
  run.matchErr("offline");
  run.matchErr("weird: unknown release");
  run.expectExit(1);

  // Project asking for nonexistent release.
  s.cd('myapp2', function () {
    s.write(".meteor/release", "strange");
    s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'not-found');
    run = s.run();
    run.matchErr("version strange of Meteor");
    run.matchErr("valid Meteor release");
    run.expectExit(1);

    // You're offline and project asks for non-cached release.
    s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
    run = s.run();
    run.matchErr("offline");
    run.matchErr("Meteor strange");
    run.matchErr("not installed");
    run.expectExit(1);

    // You create an app from a checkout, and then try to use it from an
    // install without setting a release on it.
    s.unset('METEOR_TEST_FAIL_RELEASE_DOWNLOAD');
    s.write(".meteor/release", "none");
    run = s.run("--requires-release");
    run.matchErr("must specify");
    run.matchErr("permanently set");
    run.expectExit(1);

    // As previous, but you pass --release to manually pick a release.
    run = s.run("--long-version", "--release", "v1");
    run.expectExit(0);
    run.forbidAll("must specify");
    run.forbidAll("permanently set");
<commit_msg>fix springboard test<commit_after>var selftest = require('../selftest.js');
var Sandbox = selftest.Sandbox;
var files = require('../files.js');
var catalog = require('../catalog.js');
var packageLoader = require("../package-loader.js");

// XXX: Why is this an internet using test? Because our warehouse is a
// hackhackhack. If we clean up the hackhackhackhack, then this does not need
// the internets. (Or, to be more specific: our warehouse code tries to fetch
// the packages from the internet. If we could fool it into using local packages
// instead, or think that it alreayd has the packages, it would be ok). (This is
// because it calls 'create' from a warehouse, to be specific).
selftest.define("springboard", ['checkout', 'net'], function () {
  var s = new Sandbox({
    warehouse: {
      v1: { },
      v2: { recommended: true }
    }
  });
  var run;

  var toolsPackage;
  selftest.doOrThrow(function() {
      toolsPackage = selftest.getToolsPackage();
  });
  var toolsVersion = toolsPackage.name + '@' +
        toolsPackage.version;

  // If run not in an app dir, runs the latest version ...
  run = s.run("--long-version");
  run.read('METEOR@v2\n' + toolsVersion + '\n');
  run.expectEnd();
  run.expectExit(0);

  // ... unless you asked for a different one.
  run = s.run("--long-version", "--release", "METEOR@v1");
  run.read('METEOR@v1\n' + toolsVersion + '\n');
  run.expectEnd();
  run.expectExit(0);

  // Apps are created with the latest release ...
  run = s.run("create", "myapp");
  run.waitSecs(5);
  run.expectExit(0);
  s.cd('myapp', function () {
    run = s.run("--long-version");
    run.read('METEOR@v2\n' + toolsVersion + '\n');
    run.expectExit(0);
  });

  // ... unless you asked for a different one.
  run = s.run("create", "myapp2", "--release", "METEOR@v1").expectExit(0);
  s.cd('myapp2', function () {
    run = s.run("--long-version");
    run.read('METEOR@v1\n' + toolsVersion + '\n');
    run.expectExit(0);
  });

  // Suppose you ask for a release that doesn't exist.
  s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'not-found');
  run = s.run("--release", "weird");
  run.readErr("weird: unknown release.\n");
  run.expectEnd();
  run.expectExit(1);

  // Suppose you're offline and you ask for a release you don't have
  // cached.
  // XXX On the refreshpolicy branch, we removed some of the support
  // code for this test. Make sure we get it to pass before merging.
  s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
  run = s.run("--release", "weird");
  run.matchErr("offline");
  run.matchErr("weird: unknown release");
  run.expectExit(1);

  // Project asking for nonexistent release.
  s.cd('myapp2', function () {
    s.write(".meteor/release", "strange");
    s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'not-found');
    run = s.run();
    run.matchErr("version strange of Meteor");
    run.matchErr("valid Meteor release");
    run.expectExit(1);

    // You're offline and project asks for non-cached release.
    s.set('METEOR_TEST_FAIL_RELEASE_DOWNLOAD', 'offline');
    run = s.run();
    run.matchErr("offline");
    run.matchErr("version strange of Meteor");
    run.matchErr("don't have that version of Meteor installed");
    run.matchErr("update servers");
    run.expectExit(1);

    // You create an app from a checkout, and then try to use it from an
    // install without setting a release on it.
    s.unset('METEOR_TEST_FAIL_RELEASE_DOWNLOAD');
    s.write(".meteor/release", "none");
    run = s.run("--requires-release");
    run.matchErr("must specify");
    run.matchErr("permanently set");
    run.expectExit(1);

    // As previous, but you pass --release to manually pick a release.
    run = s.run("--long-version", "--release", "v1");
    run.expectExit(0);
    run.forbidAll("must specify");
    run.forbidAll("permanently set");

{'fraction_non_alphanumeric': 0.1652162447257384, 'fraction_numerical': 0.006592827004219409, 'mean_word_length': 3.2974504249291785, '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': '321623', 'n_tokens_mistral': 2549, 'n_tokens_neox': 2494, 'n_words': 705}