Created
November 29, 2010 14:16
-
-
Save zollinger/719994 to your computer and use it in GitHub Desktop.
Set up a new cakephp project
This file contains hidden or 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 | |
CAKE_SITES_PATH="/home/stefan/wwwroot/cake/" | |
BASE_APP_PATH="/home/stefan/wwwroot/cake/app" | |
APACHE_VHOSTS_CONFIG="/etc/apache2/sites-enabled/all" | |
HOSTS_FILE="/etc/hosts" | |
if [ $# -ne 1 ] | |
then | |
echo "Usage - $0 project name" | |
echo "" | |
exit 1 | |
fi | |
TARGET_APP_PATH=$BASE_APP_PATH$1 | |
cp -r $BASE_APP_PATH $TARGET_APP_PATH | |
rm -rf "$TARGET_APP_PATH/.git" | |
mysql -u root -e "CREATE DATABASE \`$1\` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;" | |
mysql -u root $1 < "$BASE_APP_PATH/config/sql/base_app.sql" | |
echo "<? | |
class DATABASE_CONFIG { | |
var \$default = array( | |
'driver' => 'mysql', | |
'persistent' => false, | |
'host' => 'localhost', | |
'login' => 'root', | |
'password' => '', | |
'database' => '$1', | |
'prefix' => '', | |
'encoding'=>'UTF8' | |
); | |
} | |
" > $TARGET_APP_PATH/config/database.php | |
chown -R stefan:stefan $TARGET_APP_PATH | |
echo " | |
127.0.0.1 $1" >> $HOSTS_FILE | |
echo " | |
<VirtualHost *:80> | |
ServerAdmin root@localhost | |
DocumentRoot $TARGET_APP_PATH/webroot/ | |
ServerName $1 | |
</VirtualHost> | |
" >> $APACHE_VHOSTS_CONFIG | |
apache2ctl restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment