Advertisement
Guest User

Untitled

a guest
Aug 18th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. #don't forget to remove the .sh sufix from the filename.
  4.  
  5. #Author: Anthony Rodriguez
  6.  
  7. #The following script autimatically build the Ember distribution files only
  8. #after a file has changed, added or deleted within the INSPECTDIR
  9.  
  10. set -e
  11.  
  12. ROOTDIR=$PWD
  13. INSPECTDIR="htdocs/ember_app"
  14.  
  15. #inspect if any file has changed in the inspected directory between the current commit and the previous commit.
  16. FILECOUNT=$(git diff --name-only HEAD HEAD~ | awk '{print $1}' | awk -v pat="^$INSPECTDIR" '$1 ~ pat' | wc -l)
  17.  
  18. if [ $FILECOUNT -gt 0 ]; then
  19. echo "****************************\n"
  20. echo "*Building the Ember APP....*\n"
  21. echo "****************************\n"
  22.  
  23. cd $INSPECTDIR
  24. echo "Building for Production: \n" && ember build --environment=production || echo "Error: The production build Failed."
  25. echo "Building for Stage: \n" && ember build --output-path dist-stage/ --environment=stage || echo "Error: The stage build Failed."
  26. echo "Building for Dev: \n" && ember build --output-path dist-dev/ --environment=development || echo "Error: The dev build Failed."
  27. echo "Building for Local: \n" && ember build --output-path dist-local/ --environment=local || echo "Error: The local build Failed."
  28.  
  29. echo "Adding ember built files to remote...\n"
  30. git add "dist/*"
  31. git add "dist-stage/*"
  32. git add "dist-dev/*"
  33. git add "dist-local/*"
  34. git commit -m "Add ember build files"
  35. git push -u $1
  36.  
  37. cd $ROOTDIR
  38. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement