a spring boot ionic simple app

deploy.sh 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. # Warning: this script has only been tested on macOS Sierra. There's a good chance
  3. # it won't work on other operating systems. If you get it working on another OS,
  4. # please send a pull request with any changes required. Thanks!
  5. set -e
  6. ### CloudFoundry CLI utilities
  7. CLOUD_DOMAIN=${DOMAIN:-run.pivotal.io}
  8. CLOUD_TARGET=api.${DOMAIN}
  9. function login(){
  10. cf api | grep ${CLOUD_TARGET} || cf api ${CLOUD_TARGET} --skip-ssl-validation
  11. cf apps | grep OK || cf login
  12. }
  13. function app_domain(){
  14. D=`cf apps | grep $1 | tr -s ' ' | cut -d' ' -f 6 | cut -d, -f1`
  15. echo $D
  16. }
  17. function deploy_service(){
  18. N=$1
  19. D=`app_domain $N`
  20. JSON='{"uri":"http://'$D'"}'
  21. cf create-user-provided-service $N -p $JSON
  22. }
  23. ### Installation
  24. cd `dirname $0`
  25. r=`pwd`
  26. echo $r
  27. ## Reset
  28. cf d -f ionic-server
  29. cf a
  30. # Deploy the server
  31. cd $r/server
  32. mvn clean package
  33. cf push -p target/*jar ionic-server --no-start --random-route
  34. cf set-env ionic-server FORCE_HTTPS true
  35. cf start ionic-server
  36. # Get the URL for the server
  37. serverUri=https://`app_domain ionic-server`
  38. # Deploy the client
  39. cd $r/ionic-beer
  40. npm run clean
  41. # replace the server URL in the client
  42. sed -i -e "s|http://localhost:8080|$serverUri|g" src/providers/beer-service.ts
  43. npm install
  44. # build ios
  45. ionic cordova build ios --prod
  46. # Run on ios
  47. ionic cordova run ios
  48. # If the above command fails with the following error:
  49. # xcrun: error: unable to find utility "PackageApplication", not a developer tool or in PATH
  50. # See http://stackoverflow.com/a/43363820
  51. # cleanup changed files
  52. git checkout $r/ionic-beer
  53. rm $r/ionic-beer/src/providers/beer-service.ts-e