<commit_before>#!/bin/sh

echo '======================================'
echo '|'
echo '| Setting up telegramm box'
echo '|'
echo '| ©wonowicki 2014'
echo '| Edited by <EMAIL>'
echo '======================================'
echo ''

echo '======================================'
echo '| Pre Configuration'
echo '======================================'

# Get rid of stdin not tty errors etc - see https://github.com/mitchellh/vagrant/issues/1673
sed -i 's/^mesg n$/tty -s \&\& mesg n/g' /root/.profile

# Set locale
locale-gen en_GB
locale-gen en_GB.utf8

# update apt-get
apt-get update

echo '======================================'
echo '| Installing Apache & PHP'
echo '======================================'

#install apache2, PHP and then MySQL
apt-get -y install apache2
apt-get -y install php5 # php5-mcrypt php5-xdebug

# echo '======================================'
# echo '| Configuring Apache'
# echo '======================================'

# XDebug
# cat /vagrant/boxconfig/xdebug >> /etc/php5/apache2/conf.d/xdebug.ini

# Enable: ModRewrite, mcrypt
a2enmod rewrite
# php5enmod mcrypt

# Make session directory writable
chmod -R 777 /var/lib/php5

# Link source public to public www
rm -R /var/www/html
ln -s /vagrant/public /var/www/html

# Configure default vhost
cat /vagrant/boxconfig/vhost > /etc/apache2/sites-available/000-default.conf

# echo '======================================'
# echo '| Installing PHPUnit'
# echo '======================================'

# Install PHPUnit
# wget https://phar.phpunit.de/phpunit.phar
# chmod +x phpunit.phar
# mv phpunit.phar /usr/local/bin/phpunit

# Restart apache
service apache2 restart

echo '======================================'
echo '| Installing PHP-CS-Fixer'
echo '======================================'

curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer
chmod a+x /usr/local/bin/php-cs-fixer

echo '======================================'
echo '| Installing Composer'
echo '======================================'

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer


echo '======================================'
echo '| Installing Magento'
echo '======================================'

sudo apt-get install mysql-server

sudo apt-get install php5-curl
sudo apt-get install php5-mcrypt
sudo apt-get install php5-gd
sudo apt-get install php5-mysql

sudo php5enmod mcrypt

sudo service apache2 restart

# cd /vagrant
# composer install

# Magento shiznit
# Use mirror since official links are slow as fuck
wget http://mirror.gunah.eu/magento/magento-1.9.1.0.tar.gz
tar -zxvf magento-1.9.1.0.tar.gz
wget http://mirror.gunah.eu/magento/sample-data/magento-sample-data-1.9.0.0.tar.gz
tar -zxvf magento-sample-data-1.9.0.0.tar.gz

# this throws an error - but it doesn't matter ;)
mv magento-sample-data-1.9.0.0/media/* magento/media/
mv magento-sample-data-1.9.0.0/magento_sample_data_for_1.9.0.0.sql magento/data.sql
mv magento/* magento/.htaccess* .
chmod -R o+w media var

# Set up magento database
echo "create database magento" | mysql -u root -ppassword
mysql -h localhost -u root -ppassword magento < data.sql
chmod o+w var var/.htaccess app/etc

# Must now set up using the Magento install tool

# rm -rf magento/ magento-sample-data-1.9.0.0/ magento-1.9.0.0.tar.gz magento-sample-data-1.9.0.0.tar.gz data.sql
# http://localhost:8001/
# admin password is: <PASSWORD>
# encryption key is: <KEY>
<commit_msg>Amended bootstrap<commit_after>#!/bin/sh

echo '======================================'
echo '|'
echo '| Setting up telegramm box'
echo '|'
echo '| ©wonowicki 2014'
echo '| Edited by <EMAIL>'
echo '======================================'
echo ''

echo '======================================'
echo '| Pre Configuration'
echo '======================================'

# Get rid of stdin not tty errors etc - see https://github.com/mitchellh/vagrant/issues/1673
sed -i 's/^mesg n$/tty -s \&\& mesg n/g' /root/.profile

# Set locale
locale-gen en_GB
locale-gen en_GB.utf8

# update apt-get
apt-get update

echo '======================================'
echo '| Installing Apache & PHP'
echo '======================================'

#install apache2, PHP and then MySQL
apt-get -y install apache2
apt-get -y install php5 # php5-mcrypt php5-xdebug

# echo '======================================'
# echo '| Configuring Apache'
# echo '======================================'

# XDebug
# cat /vagrant/boxconfig/xdebug >> /etc/php5/apache2/conf.d/xdebug.ini

# Enable: ModRewrite, mcrypt
a2enmod rewrite
# php5enmod mcrypt

# Make session directory writable
chmod -R 777 /var/lib/php5

# Configure default vhost
cat /vagrant/boxconfig/vhost > /etc/apache2/sites-available/000-default.conf

# echo '======================================'
# echo '| Installing PHPUnit'
# echo '======================================'

# Install PHPUnit
# wget https://phar.phpunit.de/phpunit.phar
# chmod +x phpunit.phar
# mv phpunit.phar /usr/local/bin/phpunit

# Restart apache
service apache2 restart

echo '======================================'
echo '| Installing PHP-CS-Fixer'
echo '======================================'

curl http://cs.sensiolabs.org/get/php-cs-fixer.phar -o /usr/local/bin/php-cs-fixer
chmod a+x /usr/local/bin/php-cs-fixer

echo '======================================'
echo '| Installing Composer'
echo '======================================'

curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/bin/composer


echo '======================================'
echo '| Installing Magento'
echo '======================================'

export DEBIAN_FRONTEND=noninteractive
apt-get -q -y install mysql-server

apt-get -y install php5-curl
apt-get -y install php5-mcrypt
apt-get -y install php5-gd
apt-get -y install php5-mysql
php5enmod mcrypt

service apache2 restart

# cd /vagrant
# composer install

# Magento shiznit
# Use mirror since official links are slow as fuck

# TODO fix this shit

cd /var/www/html
wget http://mirror.gunah.eu/magento/magento-1.9.1.0.tar.gz -o /dev/null
tar -zxvf magento-1.9.1.0.tar.gz
wget http://mirror.gunah.eu/magento/sample-data/magento-sample-data-1.9.0.0.tar.gz -o /dev/null
tar -zxvf magento-sample-data-1.9.0.0.tar.gz

# this throws an error - but it doesn't matter ;)
mv magento-sample-data-1.9.0.0/media/* magento/media/
mv magento-sample-data-1.9.0.0/magento_sample_data_for_1.9.0.0.sql magento/data.sql
mv magento/* magento/.htaccess* .
chmod -R o+w media var

# Set up magento database
echo "create database magento" | mysql -u root -ppassword
mysql -h localhost -u root -ppassword magento < data.sql
chmod o+w var var/.htaccess app/etc

# TODO uncomment this
# rm -rf magento/ magento-sample-data-1.9.0.0/ magento-1.9.0.0.tar.gz magento-sample-data-1.9.0.0.tar.gz data.sql

# Must now set up using the Magento install tool
# http://localhost:8001/
# admin password is: <PASSWORD>
# encryption key is: <KEY>

{'fraction_non_alphanumeric': 0.2873015873015873, 'fraction_numerical': 0.022222222222222223, 'mean_word_length': 4.513922036595067, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 15, 'https://': 6, 'lorem ipsum': 0, 'www.': 3, 'xml': 0}, 'pii_count': 20, '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': '4701352', 'n_tokens_mistral': 2478, 'n_tokens_neox': 2314, 'n_words': 580}