system.sh 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. command=${1}
  3. case "${command}" in
  4. install)
  5. firsttime=${2}
  6. git submodule update --init --recursive
  7. composer install --no-dev --optimize-autoloader
  8. if [[ ${firsttime} == "--firsttime" ]]; then
  9. php bin/console doctrine:database:create
  10. php bin/console doctrine:schema:update --force
  11. php bin/console doctrine:fixtures:load
  12. php bin/console CmsED:Users:Create
  13. fi
  14. php bin/console assetic:dump
  15. php bin/console doctrine:schema:update --force
  16. rm -rf var/cache/{prod,dev}
  17. ;;
  18. update)
  19. composer update
  20. git submodule update --init --recursive
  21. php bin/console assetic:dump
  22. php bin/console doctrine:schema:update --force
  23. rm -rf var/cache/{prod,dev}
  24. ;;
  25. release)
  26. version=${2}
  27. if [[ -z "${version}" ]]; then
  28. echo -e "\e[41m \e[49m"
  29. echo -e "\e[41m \e[1m[error]\e[0m\e[41m \e[49m"
  30. echo -e "\e[41m version not provided. \e[49m"
  31. echo -e "\e[41m \e[49m"
  32. exit 4
  33. fi
  34. git checkout master
  35. sed -i "/ version:/c\ version: \"${version}\"" app/config/config.yml
  36. git add app/config/config.yml
  37. git commit -m "Version Bump"
  38. git checkout release
  39. git merge master -m"${version} release"
  40. git tag "${version}"
  41. git push --force
  42. git checkout master
  43. git push --force
  44. git push --tags
  45. echo -e "\e[42m \e[49m"
  46. echo -e "\e[42m \e[1m[OK]\e[0m\e[42m \e[49m"
  47. echo -e "\e[42m Version released \e[49m"
  48. echo -e "\e[42m \e[49m"
  49. ;;
  50. push)
  51. message=${2}
  52. if [[ -z "${message}" ]]; then
  53. echo -e "\e[41m \e[49m"
  54. echo -e "\e[41m \e[1m[error]\e[0m\e[41m \e[49m"
  55. echo -e "\e[41m message not provided. \e[49m"
  56. echo -e "\e[41m \e[49m"
  57. exit 4
  58. fi
  59. git add -A
  60. git commit -m"${message}"
  61. git push --force
  62. echo -e "\e[42m \e[49m"
  63. echo -e "\e[42m \e[1m[OK]\e[0m\e[42m \e[49m"
  64. echo -e "\e[42m Pushed to server \e[49m"
  65. echo -e "\e[42m \e[49m"
  66. ;;
  67. server)
  68. action=${2}
  69. if [ "${action}" != "start" ] && [ "${action}" != "stop" ]; then
  70. echo -e "\e[41m \e[49m"
  71. echo -e "\e[41m \e[1m[error]\e[0m\e[41m \e[49m"
  72. echo -e "\e[41m Action not provided \e[49m"
  73. echo -e "\e[41m \e[49m"
  74. exit 4
  75. fi
  76. ip=${3}
  77. php bin/console server:${action} ${ip}
  78. ;;
  79. esac