<commit_before>#!/bin/bash

set -e

BRANCH=$1

if [ "x$BRANCH" = "x" ]; then
  echo "Please pass branch to deploy as first argument"
  exit 1
fi

if [ ! -d yunity-core ]; then
  git clone https://github.com/yunity/yunity-core.git
fi

if [ ! -d yunity-core/env ]; then
  virtualenv --python=python3 --no-site-packages yunity-core/env
fi

cat <<-CONFIG > yunity-core/config/local_settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'yunity-dev',
        'USER': 'yunity-dev',
        'PASSWORD': '<PASSWORD>',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
DEBUG = False
ALLOWED_HOSTS = ['dev.yunity.org']
CONFIG

dropdb --if-exists yunity-dev
createdb yunity-dev

(
  cd yunity-core && \
  git clean -fd && \
  git checkout $BRANCH && \
  git pull && \
  env/bin/pip install -r requirements.txt && \
  env/bin/python manage.py remakeallmigrations && \
  env/bin/python manage.py migrate && \
  env/bin/python manage.py check --deploy
)

touch /tmp/yunity-dev.reload<commit_msg>Run collectstatic on deploy + STATIC_ROOT config<commit_after>#!/bin/bash

set -e

BRANCH=$1

if [ "x$BRANCH" = "x" ]; then
  echo "Please pass branch to deploy as first argument"
  exit 1
fi

if [ ! -d yunity-core ]; then
  git clone https://github.com/yunity/yunity-core.git
fi

if [ ! -d yunity-core/env ]; then
  virtualenv --python=python3 --no-site-packages yunity-core/env
fi

deploy_dir=$(pwd)

cat <<-CONFIG > yunity-core/config/local_settings.py
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.postgresql',
        'NAME': 'yunity-dev',
        'USER': 'yunity-dev',
        'PASSWORD': '<PASSWORD>',
        'HOST': '127.0.0.1',
        'PORT': '5432',
    }
}
DEBUG = False
ALLOWED_HOSTS = ['dev.yunity.org']
STATIC_ROOT = '${deploy_dir}/yunity-core/static/'
CONFIG

dropdb --if-exists yunity-dev
createdb yunity-dev

(
  cd yunity-core && \
  git clean -fd && \
  git checkout $BRANCH && \
  git pull && \
  env/bin/pip install -r requirements.txt && \
  env/bin/python manage.py remakeallmigrations && \
  env/bin/python manage.py migrate && \
  env/bin/python manage.py check --deploy && \
  env/bin/python manage.py collectstatic
)

touch /tmp/yunity-dev.reload
{'fraction_non_alphanumeric': 0.1616206589492431, 'fraction_numerical': 0.01157613535173642, 'mean_word_length': 2.802030456852792, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, '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': '3988127', 'n_tokens_mistral': 863, 'n_tokens_neox': 839, 'n_words': 190}