<commit_before>#!/bin/bash

# Expected directories layout is as follows:
# ~/codebrag - contains everything related to codebrag binary
# ~/codebrag/codebrag - currently installed package of codebrag
# ~/codebrag/prev_package - previous package, backup
# ~/codebrag/config - contains instance specific files that will be copied to installation dir
# Repository data should be placed somewhere in ~/codebrag directory and correctly referenced in config file

# exit on any error
set -e

if [ ! $# -eq  2 ]
then
  echo "usage: deploy-package.sh [package zip file] [installation base dir]"
  exit 1
fi

PACKAGE=$1  # zip package file
BASE_DIR=$2 # installation base dir

INSTALL_DIR="$BASE_DIR/codebrag"
BACKUP_DIR="$BASE_DIR/prev_package"
CONFIG_DIR="$BASE_DIR/config"

# backup current version
if [ -d $INSTALL_DIR ]
then
  echo "Backup current version to $BACKUP_DIR"
  rm -rf $BACKUP_DIR
  mv $INSTALL_DIR $BACKUP_DIR
fi

# extract package
echo "Extract new package to $BASE_DIR"
unzip $PACKAGE -d $BASE_DIR

# override package config with instance specific
if [ -d $CONFIG_DIR ]
then
  echo "Overwrite configs with $CONFIG_DIR"
  cp -r $CONFIG_DIR/* $INSTALL_DIR
fi

# cleanup downloaded package
echo "Cleanup package"
rm $PACKAGE

echo "Done"<commit_msg>Change deploy script.<commit_after>#!/bin/bash

# Expected directories layout is as follows:
# ~/codebrag - contains everything related to codebrag binary
# ~/codebrag/codebrag - currently installed package of codebrag
# ~/codebrag/prev_package - previous package, backup
# ~/codebrag/config - contains instance specific files that will be copied to installation dir
# Repository data should be placed somewhere in ~/codebrag directory and correctly referenced in config file

# exit on any error
set -e

if [ ! $# -eq  2 ]
then
  echo "usage: deploy-package.sh [package zip file] [installation base dir]"
  exit 1
fi

PACKAGE=$1  # zip package file
BASE_DIR=$2 # installation base dir

INSTALL_DIR="$BASE_DIR/codebrag"
BACKUP_DIR="$BASE_DIR/prev_package"
CONFIG_DIR="$BASE_DIR/config"

# backup current version
if [ -d $INSTALL_DIR ]
then
  echo "Backup current version to $BACKUP_DIR"
  rm -rf $BACKUP_DIR
  mv $INSTALL_DIR $BACKUP_DIR
fi

# extract package
echo "Extract new package to $BASE_DIR"
unzip $PACKAGE -d $BASE_DIR

# override package config with instance specific
if [ -d $CONFIG_DIR ]
then
  echo "Overwrite configs with $CONFIG_DIR"
  cp -rf $CONFIG_DIR/* $INSTALL_DIR
fi

# cleanup downloaded package
echo "Cleanup package"
rm $PACKAGE

echo "Done"
{'fraction_non_alphanumeric': 0.0860769535898453, 'fraction_numerical': 0.0031733439111463705, 'mean_word_length': 4.604444444444445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3796608', 'n_tokens_mistral': 809, 'n_tokens_neox': 788, 'n_words': 293}