Skip to content

Instantly share code, notes, and snippets.

@fredyounan
Forked from mnshankar/post-receive.sh
Last active August 29, 2015 14:09
Show Gist options
  • Save fredyounan/879b8b0e895c1f41c0f3 to your computer and use it in GitHub Desktop.
Save fredyounan/879b8b0e895c1f41c0f3 to your computer and use it in GitHub Desktop.
#!/bin/sh
WEBROOT=/var/www/domain.com/project
GIT_WORK_TREE=$WEBROOT git checkout -f
#change directory to the project dir
cd $WEBROOT
rm -f storage/cache/*
echo 'cache cleared'
rm -f storage/views/*
echo 'views cleared'
# Check if a composer.json file is present
if [ -f composer.json ]; then
# Detect composer binary
if which composer >/dev/null; then
composer='composer'
elif which composer.phar >/dev/null; then
composer='composer.phar'
else
# Install composer
curl -s http://getcomposer.org/installer | php >/dev/null
composer='php composer.phar'
fi
# Install or update packages specified in the lock file
$composer install
fi
# migrate database if required
php artisan migrate
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment