<commit_before>#!/usr/bin/env bash

. /opt/scripts/common.bash

set -e # Exit on errors

echo "-> Starting Stash ..."
echo "   - STASH_VERSION: $STASH_VERSION"
echo "   - STASH_HOME:    $STASH_HOME"

if [ -z "$STASH_HOME" ]; then
  export STASH_HOME=/opt/atlassian-home
fi

STASH_DIR=/opt/atlassian-stash-$STASH_VERSION
if [ -d $STASH_DIR ]; then
  echo "-> Stash $STASH_VERSION already found at $STASH_DIR. Skipping download."
else
  STASH_TARBALL_URL=http://www.atlassian.com/software/stash/downloads/binary/atlassian-stash-$STASH_VERSION.tar.gz
  echo "-> Downloading Stash $STASH_VERSION from $STASH_TARBALL_URL ..."
  wget --progress=dot:mega $STASH_TARBALL_URL -O /tmp/atlassian-stash.tar.gz
  echo "-> Extracting to $STASH_DIR ..."
  tar xzf /tmp/atlassian-stash.tar.gz -C /opt
  rm -f /tmp/atlassian-stash.tar.gz
  echo "-> Installation completed"
fi

if [ "$CONTEXT_PATH" == "ROOT" -o -z "$CONTEXT_PATH" ]; then
  CONTEXT_PATH=
else
  echo "Setting context path to: $CONTEXT_PATH"
  CONTEXT_PATH="/$CONTEXT_PATH"
fi
xmlstarlet ed --inplace --update '//Context/@path' -v "$CONTEXT_PATH" $STASH_DIR/conf/server.xml

mkdir -p $STASH_HOME

if [ -n "$DATABASE_URL" ]; then
  extract_database_url "$DATABASE_URL" DB $STASH_HOME/lib
  cat << EOF > $STASH_HOME/stash-config.properties
#>*******************************************************
#> Migrated to database at $DB_JDBC_URL
#> Generated by launch script on `date`
#>*******************************************************
jdbc.driver=$DB_JDBC_DRIVER
jdbc.url=$DB_JDBC_URL
jdbc.user=$DB_USER
jdbc.password=$<PASSWORD>PASSWORD
EOF

fi

echo "-> Running Stash server ..."
$STASH_DIR/bin/start-stash.sh -fg
<commit_msg>used > 3.2 path<commit_after>#!/usr/bin/env bash

. /opt/scripts/common.bash

set -e # Exit on errors

echo "-> Starting Stash ..."
echo "   - STASH_VERSION: $STASH_VERSION"
echo "   - STASH_HOME:    $STASH_HOME"

if [ -z "$STASH_HOME" ]; then
  export STASH_HOME=/opt/atlassian-home
fi

STASH_DIR=/opt/atlassian-stash-$STASH_VERSION
if [ -d $STASH_DIR ]; then
  echo "-> Stash $STASH_VERSION already found at $STASH_DIR. Skipping download."
else
  STASH_TARBALL_URL=http://www.atlassian.com/software/stash/downloads/binary/atlassian-stash-$STASH_VERSION.tar.gz
  echo "-> Downloading Stash $STASH_VERSION from $STASH_TARBALL_URL ..."
  wget --progress=dot:mega $STASH_TARBALL_URL -O /tmp/atlassian-stash.tar.gz
  echo "-> Extracting to $STASH_DIR ..."
  tar xzf /tmp/atlassian-stash.tar.gz -C /opt
  rm -f /tmp/atlassian-stash.tar.gz
  echo "-> Installation completed"
fi

if [ "$CONTEXT_PATH" == "ROOT" -o -z "$CONTEXT_PATH" ]; then
  CONTEXT_PATH=
else
  echo "Setting context path to: $CONTEXT_PATH"
  CONTEXT_PATH="/$CONTEXT_PATH"
fi
xmlstarlet ed --inplace --update '//Context/@path' -v "$CONTEXT_PATH" $STASH_DIR/conf/server.xml

mkdir -p $STASH_HOME/shared

if [ -n "$DATABASE_URL" ]; then
  extract_database_url "$DATABASE_URL" DB $STASH_HOME/lib
  cat << EOF > $STASH_HOME/shared/stash-config.properties
#>*******************************************************
#> Migrated to database at $DB_JDBC_URL
#> Generated by launch script on `date`
#>*******************************************************
jdbc.driver=$DB_JDBC_DRIVER
jdbc.url=$DB_JDBC_URL
jdbc.user=$DB_USER
jdbc.password=$<PASSWORD>
EOF

fi

echo "-> Running Stash server ..."
$STASH_DIR/bin/start-stash.sh -fg

{'fraction_non_alphanumeric': 0.20071471113758188, 'fraction_numerical': 0.0005955926146515784, 'mean_word_length': 4.391653290529695, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 28, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6668075', 'n_tokens_mistral': 1291, 'n_tokens_neox': 1253, 'n_words': 260}