Last active
August 29, 2015 14:07
-
-
Save motin/e184b909b4aa9885d73a to your computer and use it in GitHub Desktop.
phundament4-sakila-test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
set -o errexit | |
if [ ! -d "sakila-db" ]; then | |
wget http://downloads.mysql.com/docs/sakila-db.tar.gz | |
tar -xvf sakila-db.tar.gz | |
fi | |
php ../vendor/neam/php-app-config/export.php | tee /tmp/php-app-config.sh | |
source /tmp/php-app-config.sh | |
export PH4_DATABASE_NAME="phundament4_$DATABASE_NAME" | |
export PH4_TEST_DB_NAME="phundament4_$TEST_DB_NAME" | |
echo "DROP DATABASE IF EXISTS $PH4_DATABASE_NAME; CREATE DATABASE $PH4_DATABASE_NAME;" | mysql -h$DATABASE_HOST -P$DATABASE_PORT -u$DATABASE_USER --password=$DATABASE_PASSWORD | |
echo "DROP DATABASE IF EXISTS $PH4_TEST_DB_NAME; CREATE DATABASE $PH4_TEST_DB_NAME;" | mysql -h$TEST_DB_HOST -P$TEST_DB_PORT -u$TEST_DB_USER --password=$TEST_DB_PASSWORD | |
cat sakila-db/sakila-schema.sql | grep -v 'sakila;' | sed 's/sakila\.//g' > sakila-db/schema-to-import.sql | |
cat sakila-db/sakila-data.sql | grep -v 'sakila;' > sakila-db/data-to-import.sql | |
mysql -h$DATABASE_HOST -P$DATABASE_PORT -u$DATABASE_USER --password=$DATABASE_PASSWORD $PH4_DATABASE_NAME < sakila-db/schema-to-import.sql | |
mysql -h$DATABASE_HOST -P$DATABASE_PORT -u$DATABASE_USER --password=$DATABASE_PASSWORD $PH4_DATABASE_NAME < sakila-db/data-to-import.sql | |
echo "Use the following DSNs in the installation instructions below" | |
echo "mysql:host=$DATABASE_HOST;port=$DATABASE_PORT;dbname=$PH4_DATABASE_NAME" | |
echo "mysql:host=$TEST_DB_HOST;port=$TEST_DB_PORT;dbname=$PH4_TEST_DB_NAME" | |
if [ ! -d "phundament4-sakila-test" ]; then | |
composer.phar global require "fxp/composer-asset-plugin:1.0.0-beta2" | |
composer.phar create-project --stability=dev phundament/app:4.0.x-dev phundament4-sakila-test | |
else | |
cd phundament4-sakila-test | |
git pull | |
composer.phar install --prefer-source | |
./yii migrate | |
./yii app/admin-user | |
fi | |
echo "Now make sure you have a local MAMP server or similar and go the roots of phundament4-sakila-test/backend/web/ and phundament4-sakila-test/frontend/web/" | |
echo "If you chose an auto-generated value for the password, the following credentials will work:" | |
cat phundament4-sakila-test/console/runtime/mail/* | grep Username | |
cat phundament4-sakila-test/console/runtime/mail/* | grep Password |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment