<commit_before>key=${WERCKER_CLOUD_FOUNDRY_ENV_KEYNAME}
appname=${WERCKER_CLOUD_FOUNDRY_ENV_APPNAME}
username=$WERCKER_CLOUD_FOUNDRY_DEPLOY_USERNAME
password=$WER<PASSWORD>_CLOUD_FOUNDRY_DEPLOY_PASSWORD
organization=$WERCKER_CLOUD_FOUNDRY_DEPLOY_ORGANIZATION
space=${WERCKER_CLOUD_FOUNDRY_DEPLOY_SPACE-development}
cf login -u $username -p $password -o $organization -s $space
cf set-env $appname $key ${!key}<commit_msg>Use a modern approach to running cf commands.<commit_after>main() {
  set -e;

  # Assign global variables to local

  local appname="$WERCKER_CLOUD_FOUNDRY_DEPLOY_APPNAME"
  local alt_appname="$WERCKER_CLOUD_FOUNDRY_DEPLOY_ALT_APPNAME"
  local username="$WERCKER_CLOUD_FOUNDRY_DEPLOY_USERNAME"
  local password="<PASSWORD>"
  local organization="$WERCKER_CLOUD_FOUNDRY_DEPLOY_ORGANIZATION"
  local space="$WERCKER_CLOUD_FOUNDRY_DEPLOY_SPACE"
  local domain="$WERCKER_CLOUD_FOUNDRY_DEPLOY_DOMAIN"
  local hostname="$WERCKER_CLOUD_FOUNDRY_DEPLOY_HOSTNAME"
  local api="$WERCKER_CLOUD_FOUNDRY_DEPLOY_API"
  local skip_ssl="$WERCKER_CLOUD_FOUNDRY_DEPLOY_SKIP_SSL"
  local key="$WERCKER_CLOUD_FOUNDRY_ENV_KEYNAME"

  # Validate variables
  if [ -z "$appname" ] || [ -z "$username" ] || [ -z "$password" ] || [ -z "$organization" ] || [ -z "$space" ] ; then
    fail "appname, username, password, organization and space are required; please add them to the step";
  fi

  if [ -z "$api" ]; then
    api="https://api.run.pivotal.io";
    info "api not specified; using https://api.run.pivotal.io";
  fi

  info "Downloading CF CLI";
  wget -O cf.tgz "https://cli.run.pivotal.io/stable?release=linux64-binary";
  tar -zxf cf.tgz;

  info "Logging in to CF API";
  local login_cmd="./cf login \
      -u \"$username\" \
      -p \"$password\" \
      -o \"$organization\" \
      -s \"$space\" \
      -a \"$api\"";

  if [ -n "$skip_ssl" ]; then
    login_cmd="$login_cmd --skip-ssl-validation";
  fi
  eval $login_cmd;

  cf set-env $appname $key ${!key}
  cf set-env $alt_appname $key ${!key}
}

# Run the main function
main;

{'fraction_non_alphanumeric': 0.13124387855044076, 'fraction_numerical': 0.0009794319294809011, 'mean_word_length': 4.706703910614525, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 3, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6750410', 'n_tokens_mistral': 826, 'n_tokens_neox': 826, 'n_words': 153}