Skip to content

Instantly share code, notes, and snippets.

@stonelasley
Created March 9, 2014 00:01
Show Gist options
  • Save stonelasley/9440918 to your computer and use it in GitHub Desktop.
Save stonelasley/9440918 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Written by Stone C. Lasley <slasley@gmail.com>
declare -r CAKE_PATH='/usr/lib/php5/CakePHP'
declare -r DEV_USER='user'
if [[ ! -d $CAKE_PATH ]]; then
echo "Snatchin' Yo Cake Up!"
git clone https://github.com/cakephp/cakephp.git $CAKE_PATH
sudo chown -R $DEV_USER:www-data $CAKE_PATH
fi
git --git-dir=$CAKE_PATH/.git --work-tree=$CAKE_PATH fetch --all -t
if [ $# -eq 0 ]
then
echo "No version specified checking out master"
git --git-dir=$CAKE_PATH/.git --work-tree=$CAKE_PATH checkout master
else
echo "Switching to v$1"
git --git-dir=$CAKE_PATH/.git --work-tree=$CAKE_PATH checkout tags/$1
fi
rm -rf $CAKE_PATH/app/tmp
mkdir -p $CAKE_PATH/app/tmp/{logs,sessions,tests,cache/{models,views,persistent}}
chmod -R 777 $CAKE_PATH/app/tmp
sudo ln -sf $CAKE_PATH/lib/Cake/Console/cake /usr/bin/cake
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment