<commit_before>#!/bin/bash

export LANG=en_US.UTF-8

set -e
set -x

echo "Attempting to remove ${project_name}, forcing success in case it's not installed"

# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
  if command -v $1 &>/dev/null
  then
    return 0
  else
    return 1
  fi
}

usage()
{
  echo >&2 \
  "usage: $0 [-p project_name]"
}

# Get command line arguments
while getopts :p: opt
do
  echo $opt
  case "$opt" in
    p)  project_name="$OPTARG";;
    [\?]|[\:]) usage; exit 1;;
  esac
done

if [ -z $project_name ]
then
  usage
  exit 1
fi

if exists dpkg;
then
  sudo dpkg -P $project_name || true
  sudo jenkins/server-killer.sh
  sudo dpkg -i pkg/$project_name*deb
else
  sudo rpm -ev $project_name || true
  sudo jenkins/server-killer.sh
  sudo rpm -Uvh pkg/$project_name*rpm
fi

export OMNIBUS_BIN="$(printf "%s:" /opt/*/bin)"
export OMNIBUS_EMBEDDED_BIN="$(printf "%s:" /opt/*/embedded/bin)"
export PATH=$OMNIBUS_BIN$OMNIBUS_EMBEDDED_BIN$PATH

sudo "${project_name}-ctl" reconfigure
sleep 120
sudo "${project_name}-ctl" test -J $WORKSPACE/pedant.xml

# when build succeeds, nuke the packages
find . -type d -maxdepth 1 -mindepth 1 | xargs rm -rf<commit_msg>fear the greedy glob...he will hurt you<commit_after>#!/bin/bash

export LANG=en_US.UTF-8

set -e
set -x

echo "Attempting to remove ${project_name}, forcing success in case it's not installed"

# Check whether a command exists - returns 0 if it does, 1 if it does not
exists() {
  if command -v $1 &>/dev/null
  then
    return 0
  else
    return 1
  fi
}

usage()
{
  echo >&2 \
  "usage: $0 [-p project_name]"
}

# Get command line arguments
while getopts :p: opt
do
  echo $opt
  case "$opt" in
    p)  project_name="$OPTARG";;
    [\?]|[\:]) usage; exit 1;;
  esac
done

if [ -z $project_name ]
then
  usage
  exit 1
fi

if exists dpkg;
then
  sudo dpkg -P $project_name || true
  sudo jenkins/server-killer.sh
  sudo dpkg -i pkg/$project_name*deb
else
  sudo rpm -ev $project_name || true
  sudo jenkins/server-killer.sh
  sudo rpm -Uvh pkg/$project_name*rpm
fi

export PATH=/opt/opscode/bin:/opt/opscode/embedded/bin:$PATH

sudo "${project_name}-ctl" reconfigure
sleep 120
sudo "${project_name}-ctl" test -J $WORKSPACE/pedant.xml

# when build succeeds, nuke the packages
find . -type d -maxdepth 1 -mindepth 1 | xargs rm -rf
{'fraction_non_alphanumeric': 0.12585324232081913, 'fraction_numerical': 0.012798634812286689, 'mean_word_length': 3.358736059479554, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5272195', 'n_tokens_mistral': 946, 'n_tokens_neox': 873, 'n_words': 291}