You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Open-IM-Server/scripts/githooks/pre-push

69 lines
1.9 KiB

#!/usr/bin/env bash
# Copyright © 2023 OpenIMSDK.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# ==============================================================================
#
YELLOW="\e[93m"
GREEN="\e[32m"
RED="\e[31m"
ENDCOLOR="\e[0m"
printMessage() {
printf "${YELLOW}OpenIM : $1${ENDCOLOR}\n"
}
printSuccess() {
printf "${GREEN}OpenIM : $1${ENDCOLOR}\n"
}
printError() {
printf "${RED}OpenIM : $1${ENDCOLOR}\n"
}
printMessage "Running local OpenIM pre-push hook."
if [[ `git status --porcelain` ]]; then
printError "This scripts needs to run against committed code only. Please commit or stash you changes."
exit 1
fi
COLOR_SUFFIX="\033[0m" # End all colors and special effects
PURPLE_PREFIX="\033[35m" # Purple prefix
BOLD_PREFIX="\033[1m" # Bold prefix
# Get current time
time=$(date +"%Y-%m-%d %H:%M:%S")
# Print section separator
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
# Print time of submission
echo -e "${BOLD_PREFIX}${CYAN_PREFIX}Time of submission: ${time}${COLOR_SUFFIX}"
# Print section separator
echo -e "${PURPLE_PREFIX}==========================================================${COLOR_SUFFIX}"
#
#printMessage "Running the Flutter analyzer"
#flutter analyze
#
#if [ $? -ne 0 ]; then
# printError "Flutter analyzer error"
# exit 1
#fi
#
#printMessage "Finished running the Flutter analyzer"