summaryrefslogtreecommitdiff
path: root/devscripts/release.sh
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xdevscripts/release.sh50
1 files changed, 25 insertions, 25 deletions
diff --git a/devscripts/release.sh b/devscripts/release.sh
index 0fda106..8ef1bd0 100755
--- a/devscripts/release.sh
+++ b/devscripts/release.sh
@@ -119,7 +119,7 @@ readonly EXIT_OK EXIT_RUNTIME_FAILURE EXIT_USAGE_ERROR EXIT_CONFIG_ERROR EXIT_MI
# OUTPUT HELPERS
###############################################################################
-emit() {
+function emit() {
local prefix="$1"
local color="$2"
shift 2
@@ -145,29 +145,29 @@ emit() {
printf "\n"
}
-error() {
+function error() {
emit "==> ERROR:" "$RED" "$@" >&2
}
-msg() {
+function msg() {
if [[ $QUIET -eq 0 ]]; then
emit "==>" "$GREEN" "$@"
fi
}
-warn() {
+function warn() {
if [[ $QUIET -eq 0 ]]; then
emit "==>" "$YELLOW" "$@"
fi
}
-verbose() {
+function verbose() {
if [[ $VERBOSE -eq 1 && $QUIET -eq 0 ]]; then
emit "==>" "$BLUE" "$@"
fi
}
-debug() {
+function debug() {
if [[ $DEBUG -eq 1 ]]; then
emit "==> DEBUG:" "$MAGENTA" "$@"
fi
@@ -177,7 +177,7 @@ debug() {
# HELP AND VERSION OUTPUT
###############################################################################
-print_help() {
+function print_help() {
printf "${BOLD}${MAGENTA}%s${ALL_OFF} - ${BOLD}${CYAN}%s${ALL_OFF} - ${BOLD}%s${ALL_OFF}
${BOLD}${BLUE}Usage:${ALL_OFF} ${BOLD}${MAGENTA}%s${ALL_OFF} ${BOLD}${YELLOW}[OPTION]...${ALL_OFF} ${BOLD}${GREEN}COMMAND VERSION${ALL_OFF}
@@ -213,7 +213,7 @@ ${BOLD}${BLUE}Notes:${ALL_OFF}
"$SCRIPTNAME" "$SCRIPTNAME" "$SCRIPTNAME" "$DIST_DIR"
}
-print_version() {
+function print_version() {
printf "${RED}${BOLD}Scriptname:${ALL_OFF} %s
${GREEN}${BOLD}Version:${ALL_OFF} %s
${YELLOW}${BOLD}Description:${ALL_OFF} %s
@@ -264,7 +264,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n" \
# disabled. If FORCE_COLOR is set, colors are always enabled.
###############################################################################
-setup_colors() {
+function setup_colors() {
if [[ "$ENABLE_COLOR" -eq 1 ]]; then
if tput setaf 0 >/dev/null 2>&1; then
debug "Setting colors via tput"
@@ -305,7 +305,7 @@ setup_colors() {
# RELEASE HELPERS
###############################################################################
-require_command() {
+function require_command() {
local command_name="$1"
command -v "$command_name" >/dev/null 2>&1 || {
@@ -314,7 +314,7 @@ require_command() {
}
}
-require_release_dependencies() {
+function require_release_dependencies() {
require_command date
require_command git
require_command grep
@@ -322,7 +322,7 @@ require_release_dependencies() {
require_command tar
}
-validate_version() {
+function validate_version() {
local version="$1"
if [[ ! "$version" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
@@ -331,7 +331,7 @@ validate_version() {
fi
}
-require_project_files() {
+function require_project_files() {
local file
for file in "$MAIN_SCRIPT" "$MAN_PAGE" "$README_FILE"; do
@@ -342,7 +342,7 @@ require_project_files() {
done
}
-require_clean_worktree() {
+function require_clean_worktree() {
if ! git diff --quiet --; then
error "working tree has unstaged changes"
exit $EXIT_RUNTIME_FAILURE
@@ -354,7 +354,7 @@ require_clean_worktree() {
fi
}
-require_tag_absent() {
+function require_tag_absent() {
local version="$1"
if git rev-parse -q --verify "refs/tags/v$version" >/dev/null; then
@@ -365,7 +365,7 @@ require_tag_absent() {
# Replace a literal release metadata pattern in a file.
# Keep all sed -i portability handling in this one function.
-replace_literal() {
+function replace_literal() {
local file="$1"
local pattern="$2"
local replacement="$3"
@@ -401,7 +401,7 @@ replace_literal() {
fi
}
-update_version_and_date() {
+function update_version_and_date() {
local version="$1"
local revision_date="$2"
@@ -441,7 +441,7 @@ update_version_and_date() {
fi
}
-verify_release_metadata() {
+function verify_release_metadata() {
local version="$1"
local revision_date="$2"
@@ -478,16 +478,16 @@ verify_release_metadata() {
}
}
-read_revision_date() {
+function read_revision_date() {
sed -n -E 's/^readonly DATE_OF_REVISION=([0-9]{4}-[0-9]{2}-[0-9]{2})$/\1/p' "$MAIN_SCRIPT"
}
-show_release_diff() {
+function show_release_diff() {
msg "Release metadata diff:"
git diff -- "$MAIN_SCRIPT" "$MAN_PAGE" "$README_FILE"
}
-commit_release() {
+function commit_release() {
local version="$1"
if [[ $DRY_RUN -eq 1 ]]; then
@@ -500,7 +500,7 @@ commit_release() {
git commit -m "chore(release): prepare $version"
}
-tag_release() {
+function tag_release() {
local version="$1"
if [[ $DRY_RUN -eq 1 ]]; then
@@ -512,7 +512,7 @@ tag_release() {
git tag -a "v$version" -m "Release v$version"
}
-create_archive() {
+function create_archive() {
local version="$1"
local archive_name="$PROJECT_NAME-$version.tar.gz"
local archive_path="$DIST_DIR/$archive_name"
@@ -539,7 +539,7 @@ create_archive() {
fi
}
-prepare_release() {
+function prepare_release() {
local version="$1"
local revision_date
revision_date="$(date +%F)"
@@ -557,7 +557,7 @@ prepare_release() {
show_release_diff
}
-release() {
+function release() {
local version="$1"
local revision_date