<commit_before>// System Objects
var path = require('path');
var http = require('http');
var path = require('path');
var url = require('url');

// Third Party Dependencies
var fs = require('fs-extra');
var tags = require('common-tags');
var tar = require('tar');
var Reader = require('fstream').Reader;

// Internal
var commands = require('../commands');
var lists = require('./lists/rust');
var log = require('../../log');
var Tessel = require('../tessel');
var rust = require('../../install/rust');

var exportables = {
  meta: {
    name: 'rust',
    extname: 'rs',
    binary: '.',
    entry: 'src/main.rs',
    configuration: 'Cargo.toml',
    checkConfiguration: (pushdir, basename, program) => {
      var metadata = rust.cargoMetadata(pushdir);

      // Get first package.
      var pkg = metadata.packages.pop();
      var bins = pkg.targets.filter(target => target.kind.indexOf('bin') > -1);
      var match = bins.filter(bin => bin.name === program)[0];

      if (!match) {
        throw new Error(`No Cargo binary target by the name "${program}" exists.`);
      } else {
        basename = pushdir;
      }

      return {
        basename,
        program
      };
    },
    shell: (options) => {
      return tags.stripIndent `
        #!/bin/sh
        exec /app/remote-script/${options.resolvedEntryPoint} ${options.subargs.join(' ')}
      `;<commit_msg>Describes what binary targets exist.<commit_after>// System Objects
var path = require('path');
var http = require('http');
var path = require('path');
var url = require('url');

// Third Party Dependencies
var fs = require('fs-extra');
var tags = require('common-tags');
var tar = require('tar');
var Reader = require('fstream').Reader;
var tags = require('common-tags');

// Internal
var commands = require('../commands');
var lists = require('./lists/rust');
var log = require('../../log');
var Tessel = require('../tessel');
var rust = require('../../install/rust');

var exportables = {
  meta: {
    name: 'rust',
    extname: 'rs',
    binary: '.',
    entry: 'src/main.rs',
    configuration: 'Cargo.toml',
    checkConfiguration: (pushdir, basename, program) => {
      var metadata = rust.cargoMetadata(pushdir);

      // Get first package.
      var pkg = metadata.packages.pop();
      var bins = pkg.targets.filter(target => target.kind.indexOf('bin') > -1);
      var match = bins.filter(bin => bin.name === program)[0];

      if (!match) {
        if (bins.length == 0) {
          throw new Error(`No Cargo binary targets exist. Please create a binary target named ${program}".`)
        } else {
          var err = [`No Cargo binary target "${program}" exists. Available options:`];
          err = err.concat(bins.map(x => ` $ t2 run ${x.name}`));
          throw new Error(err.join('\n'));
        }
      } else {
        basename = pushdir;
      }

      return {
        basename,
        program
      };
    },
    shell: (options) => {
      return tags.stripIndent `
        #!/bin/sh
        exec /app/remote-script/${options.resolvedEntryPoint} ${options.subargs.join(' ')}
      `;
{'fraction_non_alphanumeric': 0.17837487860148915, 'fraction_numerical': 0.0019423761735189381, 'mean_word_length': 2.643867924528302, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, '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': '5499261', 'n_tokens_mistral': 936, 'n_tokens_neox': 912, 'n_words': 248}