Skip to content

Commit

Permalink
removed unused success and _end_fold_script functions
Browse files Browse the repository at this point in the history
  • Loading branch information
mathias-luedtke committed Jan 17, 2017
1 parent 115a3e7 commit 907db28
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 56 deletions.
1 change: 0 additions & 1 deletion industrial_ci/ci_main.sh
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ export HIT_ENDOFSCRIPT=false
source ${ICI_PKG_PATH}/util.sh

trap ici_exit EXIT # install industrial_ci exit handler
trap success SIGTERM # So that this script won't terminate without verifying that all necessary steps are done.

# Start prerelease, and once it finishs then finish this script too.
if [ "$PRERELEASE" == true ]; then
Expand Down
55 changes: 0 additions & 55 deletions industrial_ci/util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -100,33 +100,6 @@ function ici_exit {
exit $exit_code
}

#######################################
# This private function can exit the shell process, as well as wrapping up the timer section on Travis CI. Internally this does:
#
# * wraps the section that is started by ici_time_start function.
# * resets signal handler for ERR to the bash default one, when `exit_code` is any error code that exits the shell. This allows subsequent signal handlers for ERR if any to be unaffected by any handlers defined beforehand.
# * exits the process if non -1 value is passed to `exit_code`.
#
# Arguments:
# exit_code (default: -1): Unix signal. If -1 then the process continues without exiting.
# color_wrap (default: 32): Color code for the section delimitter text.
#######################################
function _end_fold_script {
if [ "$DEBUG_BASH" ] && [ "$DEBUG_BASH" == true ]; then set +x; fi
exit_code=${1:--1} # If 1st arg is not passed, set -1.
color_wrap=${2:-32}

if [ $exit_code -eq "1" ]; then color_wrap=31; fi # Red color
if ! [ -z $TRAVIS_FOLD_NAME ]; then
ici_time_end $color_wrap
else
echo "Previous Travis fold name not found. It might be either successful termination of the script, or wrong call. Skipping 'ici_time_end' anyway."
fi

if [ "$DEBUG_BASH" ] && [ "$DEBUG_BASH" == true ]; then set -x; fi
if [ $exit_code -ne "-1" ]; then ici_exit $exit_code; fi
}

#######################################
# Print an error message and calls "exit"
#
Expand All @@ -151,31 +124,3 @@ function error {
fi
ici_exit $exit_code
}

#######################################
# Similar to `error` function, this lets you "exit 0" and take care of other things as following, when your script on Travis CI already uses other functions from this file (util.sh).
#
# * wraps the section that is started by ici_time_start function with the echo color green.
# * reset signal handler for ERR to the bash default one. Subsequent signal handlers for ERR if any are unaffected by any handlers defined prior.
#
# Globals:
# (None)
# Arguments:
# _exit_code (default: 0): Unix signal. If -1 passed then the process continues without exiting.
# Returns:
# (None)
#######################################
function success {
_FUNC_MSG_PREFIX="[fuction success]"
_exit_code=${1:-0} # If 1st arg is not passed, set 0.
HIT_ENDOFSCRIPT=${HIT_ENDOFSCRIPT:-false}
if [ $HIT_ENDOFSCRIPT = false ]; then
if [ $_exit_code -eq 0 ]; then
echo "${_FUNC_MSG_PREFIX} Arg HIT_ENDOFSCRIPT must be true when this function exit with 0. Turn _exit_code to 1."; _exit_code=1;
else
echo "${_FUNC_MSG_PREFIX} _exit_code cannot be 0 for this func. Make sure you are calling this in a right context."; _exit_code=1;
fi
fi
if [ $_exit_code -ne "-1" ] && [ $_exit_code -ne "0" ]; then echo "${_FUNC_MSG_PREFIX} error: arg _exit_code must be either empty, -1 or 0. Returning."; return; fi
_end_fold_script $_exit_code
}

0 comments on commit 907db28

Please sign in to comment.