2019-12-30 19:12:47 +01:00
|
|
|
#!/bin/bash
|
2021-02-12 16:45:32 +01:00
|
|
|
# script d'update de framadate api, fait pour fonctionner avec le sous module git funky framadate
|
2021-02-12 15:23:27 +01:00
|
|
|
|
2019-12-30 19:12:47 +01:00
|
|
|
|
2021-02-12 16:40:15 +01:00
|
|
|
# bash colors
|
|
|
|
cecho() {
|
|
|
|
local code="\033["
|
|
|
|
case "$1" in
|
|
|
|
black | bk) color="${code}0;30m";;
|
|
|
|
red | r) color="${code}1;31m";;
|
|
|
|
green | g) color="${code}1;32m";;
|
|
|
|
yellow | y) color="${code}1;33m";;
|
|
|
|
blue | b) color="${code}1;34m";;
|
|
|
|
purple | p) color="${code}1;35m";;
|
|
|
|
cyan | c) color="${code}1;36m";;
|
|
|
|
gray | gr) color="${code}0;37m";;
|
|
|
|
*) local text="$1"
|
|
|
|
esac
|
|
|
|
[ -z "$text" ] && local text="$color$2${code}0m"
|
|
|
|
echo -e "$text"
|
|
|
|
}
|
|
|
|
|
2021-02-12 16:45:32 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " time to update the framadate setup"
|
|
|
|
cecho g "######################"
|
|
|
|
|
|
|
|
COMMAND_BUILD="build:prod:demobliss"
|
|
|
|
# git reset --hard
|
|
|
|
git pull origin master
|
|
|
|
|
|
|
|
composer install
|
|
|
|
php bin/console doctrine:schema:update --force
|
|
|
|
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " update the funky frontend submodule "
|
|
|
|
cecho g "############################################"
|
|
|
|
cecho g " verification des besoins de l'application "
|
|
|
|
cecho g "############################################"
|
|
|
|
cecho g " yarn, git, php, node et une base de données"
|
|
|
|
cecho g "############################################${reset}"
|
|
|
|
# True if $1 is an executable in $PATH
|
|
|
|
# Works in both {ba,z}sh
|
|
|
|
function is_bin_in_path {
|
|
|
|
if [[ -n $ZSH_VERSION ]]; then
|
|
|
|
builtin whence -p "$1" &> /dev/null
|
|
|
|
else # bash:
|
|
|
|
builtin type -P "$1" &> /dev/null
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ ! type yarn &> /dev/null ]; then
|
|
|
|
cecho red " ❌ la commande yarn est introuvable"
|
2021-02-12 16:09:16 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " ✅ yarn"
|
|
|
|
if [ ! type node &> /dev/null ]; then
|
|
|
|
cecho red " ❌ la commande node est introuvable"
|
2021-02-12 16:09:16 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " ✅ node"
|
|
|
|
if [ ! type git &> /dev/null ]; then
|
|
|
|
cecho g " ❌ la commande git est introuvable"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
cecho g " ✅ git"
|
2021-02-12 16:09:16 +01:00
|
|
|
|
2021-02-12 16:40:15 +01:00
|
|
|
if [ ! -f .env ]; then
|
|
|
|
cecho g " ❌ fichier d'environnement de symfony /.env"
|
2021-02-12 16:09:16 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " ✅ fichier d'environnement de symfony /.env ou /.env.local"
|
2021-02-12 16:09:16 +01:00
|
|
|
|
|
|
|
if [ ! -f bin/console ]; then
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " ❌ fichier console de symfony"
|
2021-02-12 16:09:16 +01:00
|
|
|
exit 1
|
|
|
|
fi
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " ✅ fichier console de symfony /bin/console "
|
2021-02-12 16:09:16 +01:00
|
|
|
|
|
|
|
|
2021-02-12 15:02:33 +01:00
|
|
|
if [ ! -d "funky-framadate-front" ]; then
|
|
|
|
# initiate sub directory for funky front
|
2021-02-12 16:50:21 +01:00
|
|
|
git submodule add -f https://framagit.org/framasoft/framadate/funky-framadate-front
|
2021-02-12 15:02:33 +01:00
|
|
|
git submodule init
|
|
|
|
fi
|
|
|
|
|
|
|
|
git config --global diff.submodule log
|
2019-12-30 19:12:47 +01:00
|
|
|
git submodule update
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " check dependencies of the frontend with yarn "
|
|
|
|
cecho g "######################"
|
2019-12-30 19:12:47 +01:00
|
|
|
cd funky-framadate-front
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " debug info : version of programs"
|
|
|
|
cecho g " "
|
2021-02-12 16:45:32 +01:00
|
|
|
cecho b " git current branch "
|
2021-02-12 15:04:21 +01:00
|
|
|
git show-branch
|
2021-02-12 16:45:32 +01:00
|
|
|
cecho b " node version "
|
2021-02-12 15:02:33 +01:00
|
|
|
node -v
|
2021-02-12 16:45:32 +01:00
|
|
|
cecho b " yarn version "
|
2021-02-12 15:02:33 +01:00
|
|
|
yarn -v
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g " "
|
2021-02-12 16:45:32 +01:00
|
|
|
cecho b "##############################################"
|
|
|
|
cecho b " update of the funky part, clean of local repo"
|
|
|
|
cecho g " "
|
|
|
|
git reset --hard
|
|
|
|
git remote -v
|
2021-02-12 15:23:27 +01:00
|
|
|
git fetch
|
|
|
|
git pull
|
2019-12-30 19:12:47 +01:00
|
|
|
yarn
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " building the frontend, should take around 20 seconds "
|
|
|
|
cecho g " "
|
|
|
|
cecho y " npm run $COMMAND_BUILD "
|
|
|
|
cecho g " "
|
|
|
|
cecho y " start: $(date) "
|
|
|
|
cecho g "######################"
|
2021-02-12 15:23:27 +01:00
|
|
|
npm run $COMMAND_BUILD
|
2021-02-12 14:39:45 +01:00
|
|
|
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho g "######################"
|
|
|
|
cecho g " copying built files in the public folder of the symfony project "
|
|
|
|
cecho g "######################"
|
2021-02-12 15:53:28 +01:00
|
|
|
cd ../public
|
|
|
|
rm ./*.js
|
|
|
|
rm ./*.css
|
|
|
|
cd ../funky-framadate-front
|
2021-02-12 15:23:27 +01:00
|
|
|
cp -r dist/framadate/* ../public/
|
2021-02-12 15:53:28 +01:00
|
|
|
COUNT_FILES=$(ls -larth ../public |wc -l)
|
2021-02-12 15:23:27 +01:00
|
|
|
cd ..
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho b " $COUNT_FILES fichiers de build copiés dans /public"
|
|
|
|
cecho g "##################################################################"
|
|
|
|
cecho b " renaming unieque name of JS chunks to common names for templates "
|
2021-02-12 15:53:28 +01:00
|
|
|
cd public
|
|
|
|
|
|
|
|
mv runtime* runtime.js
|
|
|
|
mv main* main.js
|
|
|
|
mv polyfills-es5* es5-polyfills.js
|
|
|
|
mv polyfills* other-polyfills.js
|
|
|
|
mv scripts* scripts.js
|
|
|
|
mv styles* styles.css
|
2021-02-12 16:40:15 +01:00
|
|
|
cecho b " finished at ------- $(date) ------- "
|
|
|
|
cecho g "##################################################################"
|
|
|
|
cecho g " "
|
|
|
|
cecho b " done. you can now see your homepage updated "
|
|
|
|
cecho g " "
|
|
|
|
cecho g "##################################################################"
|