Skip to content

Instantly share code, notes, and snippets.

@zollinger
Created November 29, 2010 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zollinger/719994 to your computer and use it in GitHub Desktop.
Save zollinger/719994 to your computer and use it in GitHub Desktop.
Set up a new cakephp project
#!/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