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

# This file is part of the Lug package.
#
# (c) <NAME> <<EMAIL>>
#
# For the full copyright and license information, please read the LICENSE
# file that was distributed with this source code.

TRAVIS_PHP_VERSION=${TRAVIS_PHP_VERSION-unknown}
LUG_DRIVER=${LUG_DRIVER-unknown}
MONGODB_BUILD=${MONGODB_BUILD-false}
UNIT_BUILD=${UNIT_BUILD-false}
BDD_BUILD=${BDD_BUILD-false}
CS_BUILD=${CS_BUILD-false}
DISPLAY=${DISPLAY-:99}
PHP_INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then
    phpenv config-rm xdebug.ini
fi

printf "\ndate.timezone = Europe/Paris" >> ${PHP_INI}

composer self-update

if [ "$MONGODB_BUILD" = true ]; then
    printf "\nextension = mongo.so" >> ${PHP_INI}
else
    composer remove --no-update doctrine/mongodb-odm-bundle
fi

if [ "$UNIT_BUILD" != true ] && [ "$BDD_BUILD" != true ]; then
    composer remove --dev --no-update phpunit/phpunit
    composer remove --dev --no-update symfony/phpunit-bridge
fi

if [ "$BDD_BUILD" = true ]; then
    export DISPLAY=${DISPLAY}
    /sbin/start-stop-daemon -Sbmq -p /tmp/xvfb_99.pid -x /usr/bin/Xvfb -- ${DISPLAY} -ac -screen 0, 1600x1200x24

    curl http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.0.jar > selenium.jar
    curl http://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip > chromedriver.zip
    unzip chromedriver.zip

    java -jar selenium.jar -Dwebdriver.chrome.driver=./chromedriver > /dev/null 2>&1 &

    printf "\nalways_populate_raw_post_data = -1" >> ${PHP_INI}

    if [ "$LUG_DRIVER" != "doctrine/orm" ]; then
        composer remove --no-update doctrine/dbal
        composer remove --no-update doctrine/orm
        composer remove --no-update doctrine/doctrine-bundle
        composer remove --dev --no-update doctrine/doctrine-fixtures-bundle
    else
        mysql -e "CREATE DATABASE lug_test;"<commit_msg>[Travis] Fix mysql database init<commit_after>#!/usr/bin/env bash

# This file is part of the Lug package.
#
# (c) <NAME> <<EMAIL>>
#
# For the full copyright and license information, please read the LICENSE
# file that was distributed with this source code.

TRAVIS_PHP_VERSION=${TRAVIS_PHP_VERSION-unknown}
LUG_DRIVER=${LUG_DRIVER-unknown}
MONGODB_BUILD=${MONGODB_BUILD-false}
UNIT_BUILD=${UNIT_BUILD-false}
BDD_BUILD=${BDD_BUILD-false}
CS_BUILD=${CS_BUILD-false}
DISPLAY=${DISPLAY-:99}
PHP_INI=~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini

if [ "$TRAVIS_PHP_VERSION" != "hhvm" ]; then
    phpenv config-rm xdebug.ini
fi

printf "\ndate.timezone = Europe/Paris" >> ${PHP_INI}

if [ "$LUG_DRIVER" = "doctrine/orm" ]; then
    mysql -e "CREATE DATABASE lug_test;"
fi

composer self-update

if [ "$MONGODB_BUILD" = true ]; then
    printf "\nextension = mongo.so" >> ${PHP_INI}
else
    composer remove --no-update doctrine/mongodb-odm-bundle
fi

if [ "$UNIT_BUILD" != true ] && [ "$BDD_BUILD" != true ]; then
    composer remove --dev --no-update phpunit/phpunit
    composer remove --dev --no-update symfony/phpunit-bridge
fi

if [ "$BDD_BUILD" = true ]; then
    export DISPLAY=${DISPLAY}
    /sbin/start-stop-daemon -Sbmq -p /tmp/xvfb_99.pid -x /usr/bin/Xvfb -- ${DISPLAY} -ac -screen 0, 1600x1200x24

    curl http://selenium-release.storage.googleapis.com/2.48/selenium-server-standalone-2.48.0.jar > selenium.jar
    curl http://chromedriver.storage.googleapis.com/2.12/chromedriver_linux64.zip > chromedriver.zip
    unzip chromedriver.zip

    java -jar selenium.jar -Dwebdriver.chrome.driver=./chromedriver > /dev/null 2>&1 &

    printf "\nalways_populate_raw_post_data = -1" >> ${PHP_INI}

    if [ "$LUG_DRIVER" != "doctrine/orm" ]; then
        composer remove --no-update doctrine/dbal
        composer remove --no-update doctrine/orm
        composer remove --no-update doctrine/doctrine-bundle
        composer remove --dev --no-update doctrine/doctrine-fixtures-bundle
{'fraction_non_alphanumeric': 0.1426403641881639, 'fraction_numerical': 0.015174506828528073, 'mean_word_length': 3.697149643705463, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '4514083', 'n_tokens_mistral': 1465, 'n_tokens_neox': 1404, 'n_words': 303}