summaryrefslogtreecommitdiff
path: root/Biz/Bild
diff options
context:
space:
mode:
Diffstat (limited to 'Biz/Bild')
-rw-r--r--Biz/Bild/ShellHook.sh171
1 files changed, 86 insertions, 85 deletions
diff --git a/Biz/Bild/ShellHook.sh b/Biz/Bild/ShellHook.sh
index 96c2e56..1cdb8ca 100644
--- a/Biz/Bild/ShellHook.sh
+++ b/Biz/Bild/ShellHook.sh
@@ -1,88 +1,89 @@
-function help() {
- echo ""
- echo "bizdev" | figlet | lolcat
- echo ""
- echo " bild compile code"
- echo " repl start a repl"
- echo " ci run all builds and tests"
- echo " deps manage dependencies with niv"
- echo " help show this message"
- echo " lint auto-lint all changed files"
- echo " pie product improvement engine"
- echo " push send a namespace to the cloud"
- echo " ship lint, bild, and push one (or all) namespace(s)"
-}
-
+#!/usr/bin/env bash
+##
+ function help() {
+ echo ""
+ echo "bizdev" | figlet | lolcat
+ echo ""
+ echo " bild compile code"
+ echo " repl start a repl"
+ echo " ci run all builds and tests"
+ echo " deps manage dependencies with niv"
+ echo " help show this message"
+ echo " lint auto-lint all changed files"
+ echo " pie product improvement engine"
+ echo " push send a namespace to the cloud"
+ echo " ship lint, bild, and push one (or all) namespace(s)"
+ }
+#
# color codes for use with printf
-export RED='\033[0;31m'
-export GRN='\033[0;32m'
-export YEL='\033[0;33m'
-export NC='\033[0m' # No Color
-
-alias runghc="runghc --ghc-arg=-i$BIZ_ROOT"
-
-alias guile="guile -L $BIZ_ROOT"
-
-alias tree="tree -I _ -F"
-
+ export RED='\033[0;31m'
+ export GRN='\033[0;32m'
+ export YEL='\033[0;33m'
+ export NC='\033[0m' # No Color
+#
+ alias runghc="runghc --ghc-arg=-i\$BIZ_ROOT"
+ alias guile="guile -L \$BIZ_ROOT"
+ alias tree="tree -I _ -F"
# link git hooks
-rm -f $BIZ_ROOT/.git/hooks/{post-checkout,post-merge,pre-commit,pre-push}
-ln -s $BIZ_ROOT/Biz/Ide/post-checkout $BIZ_ROOT/.git/hooks/post-checkout
-ln -s $BIZ_ROOT/Biz/Ide/post-merge $BIZ_ROOT/.git/hooks/post-merge
-ln -s $BIZ_ROOT/Biz/Ide/pre-commit $BIZ_ROOT/.git/hooks/pre-commit
-ln -s $BIZ_ROOT/Biz/Ide/pre-push $BIZ_ROOT/.git/hooks/pre-push
-
-function deps() {
- niv --sources-file $BIZ_ROOT/Biz/Bild/Sources.json $@
-}
-
-function pie() {
- runghc Biz.Pie $@
-}
-
-function run-sentry() {
- urls=(
- http://que.run
- https://dragons.dev
- https://simatime.com
- https://tv.simatime.com
- https://bsima.me
- # https://herocomics.app
- )
- for url in ${urls[@]}
- do
- code=$(curl -L --max-time 10 --silent --show-error --insecure \
- --output /dev/null \
- --write-out "%{http_code}" "$url")
- case "$code" in
- 2[0-9][0-9]) printf "${GRN}$code $url${NC}\n";;
- 3[0-9][0-9]) printf "${YEL}$code $url${NC}\n";;
- 4[0-9][0-9]) printf "${YEL}$code $url${NC}\n";;
- 5[0-9][0-9]) printf "${RED}$code $url${NC}\n";;
- *) printf "${RED}$code $url${NC}\n";;
- esac
- done
-}
-
-function sentry() {
- while true
- do
- clear
- printf "%s sentry\n\n" "$(date +%Y.%m.%d..%H.%M)"
- run-sentry
- sleep 120
- done
-}
-
+ rm -f "$BIZ_ROOT/.git/hooks/{post-checkout,post-merge,pre-commit,pre-push}"
+ ln -s "$BIZ_ROOT/Biz/Ide/post-checkout" "$BIZ_ROOT/.git/hooks/post-checkout"
+ ln -s "$BIZ_ROOT/Biz/Ide/post-merge" "$BIZ_ROOT/.git/hooks/post-merge"
+ ln -s "$BIZ_ROOT/Biz/Ide/pre-commit" "$BIZ_ROOT/.git/hooks/pre-commit"
+ ln -s "$BIZ_ROOT/Biz/Ide/pre-push" "$BIZ_ROOT/.git/hooks/pre-push"
+#
+ function deps() {
+ niv --sources-file "$BIZ_ROOT/Biz/Bild/Sources.json" "$@"
+ }
+#
+ function pie() {
+ runghc Biz.Pie "$@"
+ }
+#
+ function run-sentry() {
+ urls=(
+ http://que.run
+ https://dragons.dev
+ https://simatime.com
+ https://tv.simatime.com
+ https://bsima.me
+ # https://herocomics.app
+ )
+ for url in "${urls[@]}"
+ do
+ code=$(curl -L --max-time 10 --silent --show-error --insecure \
+ --output /dev/null \
+ --write-out "%{http_code}" "$url")
+ case "$code" in
+ 2[0-9][0-9]) color=${GRN};;
+ 3[0-9][0-9]) color=${YEL};;
+ 4[0-9][0-9]) color=${YEL};;
+ 5[0-9][0-9]) color=${RED};;
+ *) color=${RED};;
+ esac
+ printf "%b%s %s%b\n" "$color" "$code" "$url" "$NC"
+ done
+ }
+#
+ function sentry() {
+ while true
+ do
+ clear
+ printf "%s sentry\n\n" "$(date +%Y.%m.%d..%H.%M)"
+ run-sentry
+ sleep 120
+ done
+ }
+#
# Poor man's ci
-function run-ci() {
- lint **/* && bild --test **/*
-}
-
-function ci() {
- time run-ci
-}
-
-export PS1='\n$(r=$? && [ $r -eq 0 ] && printf "biz" || printf "%3.*s" $r $r)> '
-
-help
+ function run-ci() {
+ lint ./**/* && bild --test ./**/*
+ }
+#
+ function ci() {
+ time run-ci
+ }
+# shellcheck disable=SC2154
+ export PS1='\n$(r=$? && [ $r -eq 0 ] && printf "biz" || printf "%3.*s" $r $r)> '
+#
+ help
+##