Skip to content

Instantly share code, notes, and snippets.

@JusteLeblanc
Created October 30, 2018 13:25
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 JusteLeblanc/fa4d85262fc50cb1ef3bfb14c0d02fbf to your computer and use it in GitHub Desktop.
Save JusteLeblanc/fa4d85262fc50cb1ef3bfb14c0d02fbf to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
confirmTrue() {
case $1 in
[nN])
false
;;
*)
true
;;
esac
}
confirmFalse() {
case $1 in
[yY])
true
;;
*)
false
;;
esac
}
read -p 'Origin branch [master]: ' base_branch
read -p 'Ticket id: ' ticket
read -p 'Do you want to reset db? [y/N]' reset_db
read -p 'Composer install? [Y/n]' composer_install
read -p 'Run migrations? [Y/n]' run_migrations
read -p 'Import fixtures? [y/N]' import_fixtures
read -p 'Install Node packages? [y/N]' install_packages
read -p 'Build assets? [Y/n]' build_assets
read -p 'Run pretest? [y/N]' run_pretest
read -p 'Pull data from preprod? [y/N]' pull_data_from_preprod
echo "Pull base branch"
if [ -z "$base_branch" ]; then
git checkout master
else
git checkout $base_branch
fi
git pull
cd ../asv_sf_modx_provisioning
if confirmTrue $composer_install; then
echo "Composer install"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current/symfony && composer install"
fi
if confirmFalse $reset_db; then
echo "Reset database"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current make db/reset"
fi
if confirmTrue $run_migrations; then
echo "Run migrations"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current && make db/migrate"
fi
if confirmFalse $import_fixtures; then
echo "Import fixtures"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current && make db/fixtures"
fi
if confirmFalse $install_packages; then
echo "Install Node packages"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current && npm install"
fi
if confirmTrue $build_assets; then
echo "Build assets"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current && make build/local"
fi
if confirmFalse $run_pretest; then
echo "Run pretest"
ssh asv-vagrant "cd /var/www/vagrant.assurancevie.com/current && make pretest"
fi
cd ../asv_sf_modx
if confirmFalse $pull_data_from_preprod; then
echo "Pull data from preprod"
echo y | sh scripts/pull_data_from_preprod.sh
fi
git checkout -b feature/$ticket
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment