<commit_before>require "thor"
require "lobot/config"
require "lobot/sobo"
require "lobot/amazon"
require "lobot/jenkins"
require "lobot/keychain"
require "lobot/known_hosts"
require "pp"
require "tempfile"
require "json"

module Lobot
  class CLI < Thor
    desc "ssh", "SSH into Lobot"
    def ssh
      exec("ssh -i #{lobot_config.server_ssh_key} ubuntu@#{lobot_config.master} -p #{lobot_config.ssh_port}")
    end

    desc "open", "Open a browser to Lobot"
    def open
      exec("open -a /Applications/Safari.app https://#{lobot_config.node_attributes.nginx.basic_auth_user}:#{lobot_config.node_attributes.nginx.basic_auth_password}@#{lobot_config.master}/")
    end

    desc "create", "Create a new Lobot server using EC2"
    def create
      ssh_key_path = File.expand_path("#{lobot_config.server_ssh_key}.pub")

      amazon.add_key_pair(lobot_config.keypair_name, ssh_key_path)
      amazon.create_security_group("lobot")
      amazon.open_port("lobot", 22, 443)
      server = amazon.launch_server("lobot", "lobot", lobot_config.instance_size)

      puts "Writing ip address for ec2: #{server.public_ip_address}"
      lobot_config.master = server.public_ip_address
      lobot_config.instance_id = server.id
      lobot_config.save

      update_known_hosts
    end

    desc "destroy_ec2", "Destroys all the lobot resources that we can find on ec2.  Be Careful!"
    def destroy_ec2
      amazon.destroy_ec2
      lobot_config.master = nil
    end

    desc "create_vagrant", "Lowers the price of heroin to reasonable levels"
    def create_vagrant
      spawn_env = {"LOBOT_SSH_KEY" => File.expand_path("#{lobot_config.server_ssh_key}.pub"),<commit_msg>Use the keypair name, Luke<commit_after>require "thor"
require "lobot/config"
require "lobot/sobo"
require "lobot/amazon"
require "lobot/jenkins"
require "lobot/keychain"
require "lobot/known_hosts"
require "pp"
require "tempfile"
require "json"

module Lobot
  class CLI < Thor
    desc "ssh", "SSH into Lobot"
    def ssh
      exec("ssh -i #{lobot_config.server_ssh_key} ubuntu@#{lobot_config.master} -p #{lobot_config.ssh_port}")
    end

    desc "open", "Open a browser to Lobot"
    def open
      exec("open -a /Applications/Safari.app https://#{lobot_config.node_attributes.nginx.basic_auth_user}:#{lobot_config.node_attributes.nginx.basic_auth_password}@#{lobot_config.master}/")
    end

    desc "create", "Create a new Lobot server using EC2"
    def create
      ssh_key_path = File.expand_path("#{lobot_config.server_ssh_key}.pub")

      amazon.add_key_pair(lobot_config.keypair_name, ssh_key_path)
      amazon.create_security_group("lobot")
      amazon.open_port("lobot", 22, 443)
      server = amazon.launch_server(lobot_config.keypair_name, "lobot", lobot_config.instance_size)

      puts "Writing ip address for ec2: #{server.public_ip_address}"
      lobot_config.master = server.public_ip_address
      lobot_config.instance_id = server.id
      lobot_config.save

      update_known_hosts
    end

    desc "destroy_ec2", "Destroys all the lobot resources that we can find on ec2.  Be Careful!"
    def destroy_ec2
      amazon.destroy_ec2
      lobot_config.master = nil
    end

    desc "create_vagrant", "Lowers the price of heroin to reasonable levels"
    def create_vagrant
      spawn_env = {"LOBOT_SSH_KEY" => File.expand_path("#{lobot_config.server_ssh_key}.pub"),
{'fraction_non_alphanumeric': 0.10619994067042421, 'fraction_numerical': 0.006526253337288638, 'mean_word_length': 3.9734513274336285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4578051', 'n_tokens_mistral': 1258, 'n_tokens_neox': 1205, 'n_words': 255}