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

#
# This script install all dependencies and configure pyAggr3g470r
# for Python 3.
#

sudo apt-get install python libpq-dev python-dev python-pip build-essential git
sudo apt-get install libxml2-dev libxslt1-dev # for lxml

sed -i '/psycopg2/d' requirements.txt
sudo pip install --upgrade -r requirements.txt

# Initializes the configuration file
cp conf/conf.cfg-sample conf/conf.cfg

# Delete default database configuration
sed -i '/database/d' conf/conf.cfg
sed -i '/uri/d' conf/conf.cfg

if [ "$1" == postgre ]; then
    sudo apt-get install -y postgresql postgresql-server-dev-9.3 postgresql-client
    sudo pip install psycopg2
    echo "127.0.0.1:5432:aggregator:pgsqluser:pgsqlpwd" > ~/.pgpass
    chmod 700 ~/.pgpass
    sudo -u postgres createuser pgsqluser --no-superuser --createdb --no-createrole
    createdb aggregator --no-password
    echo "ALTER USER pgsqluser WITH ENCRYPTED PASSWORD '<PASSWORD>';" | sudo -u postgres psql
    echo "GRANT ALL PRIVILEGES ON DATABASE aggregator TO pgsqluser;" | sudo -u postgres psql

    # Add configuration lines for PostgreSQL
    echo '[database]' >> conf/conf.cfg
    echo 'uri = postgres://pgsqluser:pgsqlpwd@127.0.0.1:5432/aggregator' >> conf/conf.cfg
elif [ "$1" == sqlite ]; then
    sudo pip install pysqlite # not working with Python 3!
    # Add configuration lines for SQLite
    echo '[database]' >> conf/conf.cfg
    echo 'uri = sqlite+pysqlite:///pyAggr3g470r.db' >> conf/conf.cfg
fi

python manager.py db_empty
python manager.py db_create<commit_msg>Added '-y' option to when installing dependencies with apt.<commit_after>#! /usr/bin/env bash

#
# This script install all dependencies and configure pyAggr3g470r
# for Python 3.
#

sudo apt-get install -y python libpq-dev python-dev python-pip build-essential git
sudo apt-get install -y libxml2-dev libxslt1-dev # for lxml

sed -i '/psycopg2/d' requirements.txt
sudo pip install --upgrade -r requirements.txt

# Initializes the configuration file
cp conf/conf.cfg-sample conf/conf.cfg

# Delete default database configuration
sed -i '/database/d' conf/conf.cfg
sed -i '/uri/d' conf/conf.cfg

if [ "$1" == postgre ]; then
    sudo apt-get install -y postgresql postgresql-server-dev-9.3 postgresql-client
    sudo pip install psycopg2
    echo "127.0.0.1:5432:aggregator:pgsqluser:pgsqlpwd" > ~/.pgpass
    chmod 700 ~/.pgpass
    sudo -u postgres createuser pgsqluser --no-superuser --createdb --no-createrole
    createdb aggregator --no-password
    echo "ALTER USER pgsqluser WITH ENCRYPTED PASSWORD '<PASSWORD>';" | sudo -u postgres psql
    echo "GRANT ALL PRIVILEGES ON DATABASE aggregator TO pgsqluser;" | sudo -u postgres psql

    # Add configuration lines for PostgreSQL
    echo '[database]' >> conf/conf.cfg
    echo 'uri = postgres://pgsqluser:pgsqlpwd@127.0.0.1:5432/aggregator' >> conf/conf.cfg
elif [ "$1" == sqlite ]; then
    sudo pip install pysqlite # not working with Python 3!
    # Add configuration lines for SQLite
    echo '[database]' >> conf/conf.cfg
    echo 'uri = sqlite+pysqlite:///pyAggr3g470r.db' >> conf/conf.cfg
fi

python manager.py db_empty
python manager.py db_create
{'fraction_non_alphanumeric': 0.10935524652338811, 'fraction_numerical': 0.025916561314791402, 'mean_word_length': 3.6204379562043796, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 4, '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': '4277083', 'n_tokens_mistral': 1146, 'n_tokens_neox': 1058, 'n_words': 329}