|
@@ -1,23 +1,41 @@
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
-echo "Running local AppFlowy pre-push hook."
|
|
|
+YELLOW="\e[93m"
|
|
|
+GREEN="\e[32m"
|
|
|
+RED="\e[31m"
|
|
|
+ENDCOLOR="\e[0m"
|
|
|
+
|
|
|
+printMessage() {
|
|
|
+ printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
+}
|
|
|
+
|
|
|
+printSuccess() {
|
|
|
+ printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
+}
|
|
|
+
|
|
|
+printError() {
|
|
|
+ printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
|
|
|
+}
|
|
|
+
|
|
|
+printMessage "Running local AppFlowy pre-push hook."
|
|
|
|
|
|
if [[ `git status --porcelain` ]]; then
|
|
|
- printf "\e[31;1m%s\e[0m\n" 'This script needs to run against committed code only. Please commit or stash you changes.'
|
|
|
+ printError "This script needs to run against committed code only. Please commit or stash you changes."
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
-printf "\e[33;1m%s\e[0m\n" 'Running the Flutter analyzer'
|
|
|
+printMessage "Running the Flutter analyzer"
|
|
|
flutter analyze
|
|
|
|
|
|
if [ $? -ne 0 ]; then
|
|
|
- printf "\e[31;1m%s\e[0m\n" 'Flutter analyzer error'
|
|
|
+ printError "Flutter analyzer error"
|
|
|
exit 1
|
|
|
fi
|
|
|
|
|
|
-printf "\e[33;1m%s\e[0m\n" 'Finished running the Flutter analyzer'
|
|
|
-printf "\e[33;1m%s\e[0m\n" 'Running unit tests'
|
|
|
+printMessage "Finished running the Flutter analyzer"
|
|
|
+
|
|
|
|
|
|
+#printMessage "Running unit tests"
|
|
|
#flutter test
|
|
|
#if [ $? -ne 0 ]; then
|
|
|
# printf "\e[31;1m%s\e[0m\n" 'Unit tests error'
|