<commit_before>#!/bin/bash
set -e
cd `php -r "echo dirname(realpath('$0'));"`
if [ -z "$1" ]; then
  env="dev"
else
  env=$1
fi

echo "Environment: " $env
echo ""

echo ">>> Cleanup cache"
rm -rf app/cache/{dev,prod}

echo ">>> Cleanup repositories"
if [ -d app/cache/repositories ]; then
    rm -rf app/cache/repositories
fi
mkdir app/cache/repositories -p

if [ ! -f "app/config/parameters.yml" ]; then
    echo ">>> Touching app/config/parmeters.yml"
    touch app/config/parameters.yml
fi

if [ ! -f composer.phar ]; then
    echo ">>> Downloading composer.phar"
    curl -s http://getcomposer.org/installer | php
fi

if [ ! -d vendor ]; then
    echo ">>> Installing dependencies"
    php composer.phar install
fi

echo ">>> Dropping database"
php app/console doctrine:database:drop --force --env=$env || true
echo ">>> Creating database"
php app/console doctrine:database:create --env=$env
echo ">>> Creating SQL schema"
php app/console doctrine:schema:create --env=$env
echo ">>> Loading fixtures in project"
php app/console doctrine:fixtures:load --append --env=$env

if [ -d "sample" ]; then
    echo ">>> Removing sample folder"
    rm sample -rf
fi

echo ">>> Create sample/ folder"
mkdir sample
git clone git://github.com/gitonomy/foobar.git sample/foobar --bare -q
git clone git://github.com/gitonomy/barbaz.git sample/barbaz --bare -q

echo ">>> Recreating repository foobar"
cd sample/foobar<commit_msg>Make reset.sh compatible with Mac<commit_after>#!/bin/bash
set -e
cd `php -r "echo dirname(realpath('$0'));"`
if [ -z "$1" ]; then
  env="dev"
else
  env=$1
fi

echo "Environment: " $env
echo ""

echo ">>> Cleanup cache"
rm -rf app/cache/{dev,prod}

echo ">>> Cleanup repositories"
if [ -d app/cache/repositories ]; then
    rm -rf app/cache/repositories
fi
mkdir -p app/cache/repositories

if [ ! -f "app/config/parameters.yml" ]; then
    echo ">>> Touching app/config/parameters.yml"
    touch app/config/parameters.yml
fi

if [ ! -f composer.phar ]; then
    echo ">>> Downloading composer.phar"
    curl -s http://getcomposer.org/installer | php
fi

if [ ! -d vendor ]; then
    echo ">>> Installing dependencies"
    php composer.phar install
fi

echo ">>> Dropping database"
php app/console doctrine:database:drop --force --env=$env || true
echo ">>> Creating database"
php app/console doctrine:database:create --env=$env
echo ">>> Creating SQL schema"
php app/console doctrine:schema:create --env=$env
echo ">>> Loading fixtures in project"
php app/console doctrine:fixtures:load --append --env=$env

if [ -d "sample" ]; then
    echo ">>> Removing sample folder"
    rm -rf sample
fi

echo ">>> Create sample/ folder"
mkdir sample
git clone git://github.com/gitonomy/foobar.git sample/foobar --bare -q
git clone git://github.com/gitonomy/barbaz.git sample/barbaz --bare -q

echo ">>> Recreating repository foobar"
cd sample/foobar
{'fraction_non_alphanumeric': 0.15295764788239413, 'fraction_numerical': 0.0021001050052502626, 'mean_word_length': 3.716171617161716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 75, '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': '1383405', 'n_tokens_mistral': 983, 'n_tokens_neox': 928, 'n_words': 289}