Skip to content

Instantly share code, notes, and snippets.

@worenga
Created October 5, 2012 00:46
Show Gist options
  • Save worenga/3837395 to your computer and use it in GitHub Desktop.
Save worenga/3837395 to your computer and use it in GitHub Desktop.
Post-Receive hook for symfony2 repositories
#!/bin/bash
CURRENT_DIR="`pwd`"
REPO_NAME="$(basename "$CURRENT_DIR")"
if [ -d "/var/www/$REPO_NAME" ]; then
cd "/var/www/$REPO_NAME" || exit
unset GIT_DIR
echo "Pulling changes to '$REPO_NAME'..."
git pull --force "/var/www/$REPO_NAME"
/var/www/$REPO_NAME/bin/vendors update
else
echo "Cloning repository..."
git clone $CURRENT_DIR "/var/www/$REPO_NAME"
cd "/var/www/$REPO_NAME" || exit
unset GIT_DIR
echo "Installing vendors..."
/var/www/$REPO_NAME/bin/vendors install --reinstall
fi
/var/www/$REPO_NAME/vendor/bundles/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta doctrine:database:drop --force
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta doctrine:database:create --force
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta doctrine:schema:drop --force
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta doctrine:schema:create
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta init:acl
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta doctrine:fixtures:load
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta cache:clear
/usr/bin/php "/var/www/$REPO_NAME/app/console" --env=sta cache:warm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment