<commit_before>#!/bin/bash

command -v aws &> /dev/null || { echo >&2 '"aws" cli tool is required. on OSX, "sudo easy_install pip && sudo pip install awscli"'; exit 1; }
command -v jq &> /dev/null || { echo >&2 '"jq" tool is required. on OSX, "brew install jq"'; exit 1; }

# aws elb describe-load-balancers

if [ ! -f .oopsrc ]; then
  echo "Missing .oopsrc, I don't know how to roll back :-("
  echo "Just make me a json file with the elb-name, that's all I need."
  echo -e "\nSample .oopsrc: "
  echo '
  {
    "elb-name": "www-octoblu-com",
    "application-name": "octoblu-www",
    "deployment-group": "master",
    "s3-bucket": "octoblu-deploy"
  }
  '
  exit 1
fi

# Validate .oopsrc
jq '.' .oopsrc &> /dev/null
if [ "$?" != "0" ]; then
  echo -e ".oopsrc is not valid JSON. Refusing to do anything else until you fix it.\n"

  jq '.' .oopsrc
  exit $?
fi

if [ "$1" == "deploy" ]; then
  oops-deploy ${*:2}
  exit $?
fi

if [ "$1" == "list" ]; then
  oops-list ${*:2}
  exit $?
fi

if [ "$1" == "rollback" ]; then
  oops-rollback ${*:2}
  exit $?
fi

echo -e "
  Usage: oops [command]

  Options:

    -h, --help   output usage information\n\n"<commit_msg>Fix usage<commit_after>#!/bin/bash

command -v aws &> /dev/null || { echo >&2 '"aws" cli tool is required. on OSX, "sudo easy_install pip && sudo pip install awscli"'; exit 1; }
command -v jq &> /dev/null || { echo >&2 '"jq" tool is required. on OSX, "brew install jq"'; exit 1; }

# aws elb describe-load-balancers

if [ ! -f .oopsrc ]; then
  echo "Missing .oopsrc, I don't know how to roll back :-("
  echo "Just make me a json file with the elb-name, that's all I need."
  echo -e "\nSample .oopsrc: "
  echo '
  {
    "elb-name": "www-octoblu-com",
    "application-name": "octoblu-www",
    "deployment-group": "master",
    "s3-bucket": "octoblu-deploy"
  }
  '
  exit 1
fi

# Validate .oopsrc
jq '.' .oopsrc &> /dev/null
if [ "$?" != "0" ]; then
  echo -e ".oopsrc is not valid JSON. Refusing to do anything else until you fix it.\n"

  jq '.' .oopsrc
  exit $?
fi

if [ "$1" == "deploy" ]; then
  oops-deploy ${*:2}
  exit $?
fi

if [ "$1" == "list" ]; then
  oops-list ${*:2}
  exit $?
fi

if [ "$1" == "rollback" ]; then
  oops-rollback ${*:2}
  exit $?
fi

echo -e "
  Usage: oops [command] [options]


  Commands:

    deploy       Deploy a specific version
    rollback     Swap ELB back to the off cluster

  Options:

    -h, --help   output usage information\n\n"
{'fraction_non_alphanumeric': 0.17784137367130007, 'fraction_numerical': 0.01062959934587081, 'mean_word_length': 2.6963746223564953, 'pattern_counts': {'":': 8, '<': 3, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '5458776', 'n_tokens_mistral': 1002, 'n_tokens_neox': 966, 'n_words': 315}