This commit is contained in:
parent
32552489f3
commit
fb994dbf31
@ -1,21 +1,73 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
|
||||
function dothis() {
|
||||
local thisthing="$1"
|
||||
local dir="$2"
|
||||
|
||||
cmd=""
|
||||
|
||||
[ ! -f "${dir}/${thisthing}.sh" ] || cmd="${dir}/${thisthing}.sh"
|
||||
[ ! -f "${dir}/${thisthing}" ] || cmd="${dir}/${thisthing}"
|
||||
|
||||
[ -n "$cmd" ] || die "No ${thisthing} script found in $dir"
|
||||
|
||||
echo "Running $cmd"
|
||||
"$cmd"
|
||||
}
|
||||
|
||||
function title() {
|
||||
local title="$1"
|
||||
local inner_width=59 # Width between the borders (box_width - 2)
|
||||
|
||||
# Get the actual display width (handles emojis correctly)
|
||||
local title_display_width
|
||||
title_display_width=$(echo -n "$title" | wc -L)
|
||||
|
||||
# Calculate total padding needed
|
||||
local total_padding=$(( inner_width - title_display_width ))
|
||||
local left_padding=$(( total_padding / 2 ))
|
||||
local right_padding=$(( total_padding - left_padding ))
|
||||
|
||||
# Top border
|
||||
echo
|
||||
printf "╔"
|
||||
printf "═%.0s" $(seq 1 $inner_width)
|
||||
printf "╗\n"
|
||||
|
||||
# Empty line
|
||||
printf "║%*s║\n" $inner_width ""
|
||||
|
||||
# Title line with padding
|
||||
printf "║%*s%s%*s║\n" $left_padding "" "$title" $right_padding ""
|
||||
|
||||
# Empty line
|
||||
printf "║%*s║\n" $inner_width ""
|
||||
|
||||
# Bottom border
|
||||
printf "╚"
|
||||
printf "═%.0s" $(seq 1 $inner_width)
|
||||
printf "╝\n"
|
||||
echo
|
||||
}
|
||||
|
||||
function buildtestpublish() {
|
||||
local dir="$1"
|
||||
|
||||
title "PROCESSING $dir"
|
||||
|
||||
cd "$dir"
|
||||
TOOLNAME=$(basename "$dir")
|
||||
|
||||
echo "Building $TOOLNAME"
|
||||
dothis build "$dir"
|
||||
|
||||
echo "Testing $TOOLNAME"
|
||||
dothis test "$dir"
|
||||
|
||||
echo "Publishing $TOOLNAME"
|
||||
dothis publish "$dir"
|
||||
|
||||
echo "Done"
|
||||
}
|
||||
@ -36,4 +88,8 @@ function buildtestpublish_all() {
|
||||
cd "$PREVIOUS_DIR"
|
||||
}
|
||||
|
||||
title "🔨 BUILDING ALL TOOLS 🔨"
|
||||
|
||||
buildtestpublish_all
|
||||
|
||||
title "🚀 Deployment Complete! 🚀"
|
||||
|
Loading…
x
Reference in New Issue
Block a user