-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from StudyTube/posix-sh
Make scripts more POSIX shell compliant
- Loading branch information
Showing
2 changed files
with
21 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,21 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
[[ -z "$GIT_DIR" ]] && GIT_DIR="."; | ||
CHANGES=$(git status --porcelain); | ||
if [[ ! -z "$CHANGES" ]]; | ||
then | ||
echo "==> Stash local changes"; | ||
git stash --quiet -u; | ||
fi; | ||
[ -z "$GIT_DIR" ] && GIT_DIR="." | ||
|
||
if [[ $(npm run | grep "^ crowdin-pre-push$" | wc -l) > 0 ]]; then | ||
echo "==> Check en.json for changes"; | ||
CHANGES="$(git status --porcelain)" | ||
if [ -n "$CHANGES" ]; then | ||
echo "==> Stash local changes" | ||
git stash --quiet -u | ||
fi | ||
|
||
if [ -n "$(npm run | grep '^ *crowdin-pre-push$')" ]; then | ||
echo "==> Check en.json for changes" | ||
npm run crowdin-pre-push | ||
fi | ||
|
||
if [[ ! -z "$CHANGES" ]]; | ||
then | ||
echo "==> Apply stashed local changes"; | ||
git stash pop --quiet; | ||
fi; | ||
if [ -n "$CHANGES" ]; then | ||
echo "==> Apply stashed local changes" | ||
git stash pop --quiet | ||
fi | ||
|
||
exit 0; | ||
exit 0 |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/bin/bash | ||
#!/bin/sh | ||
|
||
YELLOW='\033[0;33m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' | ||
|
||
if [[ -d .git ]]; then | ||
for hook in pre-push pre-commit post-merge | ||
do | ||
rm "./.git/hooks/${hook}" | ||
if [ -d .git ]; then | ||
for hook in pre-push pre-commit post-merge; do | ||
rm -f "./.git/hooks/${hook}" | ||
cp "./node_modules/ng-git-hooks/hooks/${hook}.sh" "./.git/hooks/${hook}" | ||
done | ||
|
||
echo -e "${GREEN}Success adding git hooks${NC}" | ||
else | ||
echo -e "${YELLOW}Failure adding git hooks: .git/ directory not found${NC}" | ||
fi; | ||
fi |