Created
April 2, 2018 22:02
-
-
Save paulomcnally/dc7702f1b5ef1f49a12ef264597f2125 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #! /bin/bash | |
| # get branch name | |
| branch=$(git rev-parse --abbrev-ref HEAD) | |
| # validate branch (test) | |
| if [ "$branch" == "test" ]; then | |
| echo "" | |
| echo "Preparando la precompilación" | |
| echo "" | |
| # precompile i18n.js | |
| echo "Generating i18n.js file." | |
| bundle exec rake jslang >/dev/null | |
| echo "✓ i18n.js generated." | |
| # precompile assets | |
| echo "" | |
| echo "Generating assets files." | |
| rails assets:precompile -q >/dev/null | |
| echo "✓ Assets generated." | |
| # Check if locales or assets has changed | |
| locale_has_changed=$(git diff --name-only app/assets/javascripts/i18n.js) | |
| assets_has_changed=$(git diff --name-only --stat --cached -- public/assets) | |
| if [ -n "$locale_has_changed" ] || [ -n "$assets_has_changed" ]; then | |
| echo "" | |
| echo "Generating commit." | |
| # add changes to git | |
| git add . | |
| # create git commit | |
| git commit -m "Assets precompile" | |
| echo "" | |
| echo "Please execute to add new changes:" | |
| echo "git push origin test" | |
| fi | |
| fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment