Guest User

Untitled

a guest
Nov 21st, 2018
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.94 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # update.sh
  4. #
  5. # OPTIONS
  6. # -b Skip bundle and restarting process
  7. # -f Skip yarn and webpacker
  8. # -g Skip git pull
  9. # -m Skip post deployment migrate
  10.  
  11. GIT="TRUE"
  12. FRONT="TRUE"
  13. BACK="TRUE"
  14. MIGRATE="TRUE"
  15.  
  16. while getopts bfgm OPT
  17. do
  18. case $OPT in
  19. "b" ) BACK="FALSE" ;;
  20. "f" ) FRONT="FALSE" ;;
  21. "g" ) GIT="FALSE" ;;
  22. "m" ) MIGRATE="FALSE" ;;
  23. * ) echo "Invalid option detected." 1>&2
  24. exit 1 ;;
  25. esac
  26. done
  27.  
  28. cd /home/mastodon/live
  29.  
  30. if [ "$GIT" = "TRUE" ]; then
  31. git pull origin master
  32. fi
  33.  
  34. if [ "$FRONT" = "TRUE" ]; then
  35. yarn install --pure-lockfile
  36. RAILS_ENV=production bundle exec rails assets:precompile
  37. fi
  38.  
  39. if [ "$BACK" = "TRUE" ]; then
  40. gem install bundler
  41. bundle install --deployment --without development test
  42. if [ "$MIGRATE" = "TRUE" ]; then
  43. RAILS_ENV=production bundle exec rails db:migrate
  44. else
  45. SKIP_POST_DEPLOYMENT_MIGRATIONS=true RAILS_ENV=production bundle exec rails db:migrate
  46. fi
  47. fi
  48.  
  49. exit
Add Comment
Please, Sign In to add comment