Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- #don't forget to remove the .sh sufix from the filename.
- #Author: Anthony Rodriguez
- #The following script autimatically build the Ember distribution files only
- #after a file has changed, added or deleted within the INSPECTDIR
- set -e
- ROOTDIR=$PWD
- INSPECTDIR="htdocs/ember_app"
- #inspect if any file has changed in the inspected directory between the current commit and the previous commit.
- FILECOUNT=$(git diff --name-only HEAD HEAD~ | awk '{print $1}' | awk -v pat="^$INSPECTDIR" '$1 ~ pat' | wc -l)
- if [ $FILECOUNT -gt 0 ]; then
- echo "****************************\n"
- echo "*Building the Ember APP....*\n"
- echo "****************************\n"
- cd $INSPECTDIR
- echo "Building for Production: \n" && ember build --environment=production || echo "Error: The production build Failed."
- echo "Building for Stage: \n" && ember build --output-path dist-stage/ --environment=stage || echo "Error: The stage build Failed."
- echo "Building for Dev: \n" && ember build --output-path dist-dev/ --environment=development || echo "Error: The dev build Failed."
- echo "Building for Local: \n" && ember build --output-path dist-local/ --environment=local || echo "Error: The local build Failed."
- echo "Adding ember built files to remote...\n"
- git add "dist/*"
- git add "dist-stage/*"
- git add "dist-dev/*"
- git add "dist-local/*"
- git commit -m "Add ember build files"
- git push -u $1
- cd $ROOTDIR
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement