Skip to content

Instantly share code, notes, and snippets.

@kosmala007
Last active February 11, 2020 06:59
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 kosmala007/3e7b1262a0db063ac02dcc166a881311 to your computer and use it in GitHub Desktop.
Save kosmala007/3e7b1262a0db063ac02dcc166a881311 to your computer and use it in GitHub Desktop.
Script for update symfony (git pull, composer install, doctrine schema update, clear cache, cache busting)
#!/bin/bash
BLUE='\033[0;34m'
NC='\033[0m' # No Color
COMPOSER='php73 -d memory_limit=4G composer.phar'
SF='php73 bin/console'
DOTENV='.env.local'
echo -e "${BLUE}\n---------------------- Git pull ----------------------\n${NC}"
read -r -p "Git pull? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
git pull
fi
echo -e "${BLUE}\n------------------- Composer install -----------------\n${NC}"
read -r -p "Composer install? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
eval $COMPOSER install -a --no-scripts
fi
echo -e "${BLUE}\n----------------- Doctrine shema update --------------\n${NC}"
read -r -p "Dump sql? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
eval $SF d:s:u --dump-sql
read -r -p "Force update? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
eval $SF d:s:u --force
fi
fi
echo -e "${BLUE}\n---------------- Assets version update ---------------\n${NC}"
read -r -p "Update assets version? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
CURRENT_DATE_TIME="`date +%Y%m%d%H%M%S`"
echo "varsion: ${CURRENT_DATE_TIME}"
sed -i -e "s/^ASSETS_VERSION=.*/ASSETS_VERSION=${CURRENT_DATE_TIME}/" $DOTENV
fi
echo -e "${BLUE}\n--------------------- Cache clear --------------------\n${NC}"
read -r -p "Clear cache? [Y/n]" response
response=${response,,} # tolower
if [[ $response =~ ^(yes|y| ) ]] || [[ -z $response ]]; then
eval $SF c:c
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment