Last active
August 29, 2015 14:11
-
-
Save fabiocarneiro/7912428ced988f8f824e to your computer and use it in GitHub Desktop.
This file contains 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 | |
# thanks http://www.jenssegers.be/blog/46/deploying-websites-with-git-and-composer- | |
# replace folder | |
cd "`dirname $0`/../../application/config" | |
# 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 | |
# Run composer if composer.json is updated | |
if [ composer.json -nt composer.lock ]; then | |
# Install or update depending on lock file | |
echo "Updating Composer packages" | |
[ ! -f composer.lock ] && $composer install || $composer update | |
else | |
# Regenerating autoload files | |
echo "Composer packages up to date" | |
$composer dump-autoload | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment