summaryrefslogtreecommitdiff
path: root/Biz/Ide
diff options
context:
space:
mode:
authorBen Sima <ben@bsima.me>2023-09-21 22:30:17 -0400
committerBen Sima <ben@bsima.me>2023-10-03 21:33:37 -0400
commit4226cbd8020253b010fb44d395db12efe68e1272 (patch)
tree4ee121a0cf26098b1cec1feed24c2cdd8e036562 /Biz/Ide
parentdbdf4da2576f889544a33ce0bad4b8a5ff3eca87 (diff)
Rename BIZ_ROOT to CODEROOT
BIZ_ROOT was too specific. CODEROOT allows for other (non-biz) projects to live in the root of the repo. I didn't want to call it GIT_ROOT because maybe someday I won't want to use git. But I'll never not use code.
Diffstat (limited to 'Biz/Ide')
-rwxr-xr-xBiz/Ide/ftags2
-rwxr-xr-xBiz/Ide/hooks/post-checkout4
-rwxr-xr-xBiz/Ide/hooks/post-merge2
-rwxr-xr-xBiz/Ide/hooks/pre-commit2
-rwxr-xr-xBiz/Ide/hooks/pre-push4
-rwxr-xr-xBiz/Ide/mktags16
-rwxr-xr-xBiz/Ide/ns2
-rwxr-xr-xBiz/Ide/push4
-rwxr-xr-xBiz/Ide/repl10
-rwxr-xr-xBiz/Ide/run2
-rwxr-xr-xBiz/Ide/ship4
-rwxr-xr-xBiz/Ide/tidy2
12 files changed, 27 insertions, 27 deletions
diff --git a/Biz/Ide/ftags b/Biz/Ide/ftags
index bc4fda0..02d78c5 100755
--- a/Biz/Ide/ftags
+++ b/Biz/Ide/ftags
@@ -3,7 +3,7 @@
# search tags with fzf
#
set -euo pipefail
- tags=${BIZ_ROOT:?}/tags
+ tags=${CODEROOT:?}/tags
tag_search=$(
awk 'BEGIN { FS="\t" } !/^!/ {print toupper($4)"\t"$1"\t"$2"\t"$3}' "$tags" \
| cut -c1-80 \
diff --git a/Biz/Ide/hooks/post-checkout b/Biz/Ide/hooks/post-checkout
index ef0cfa1..73488b0 100755
--- a/Biz/Ide/hooks/post-checkout
+++ b/Biz/Ide/hooks/post-checkout
@@ -1,13 +1,13 @@
#!/usr/bin/env bash
set -e
-mktags=${BIZ_ROOT:?}/Biz/Ide/mktags
+mktags=${CODEROOT:?}/Biz/Ide/mktags
old=$1
new=$2
# filter out only the changed haskell files
changed=($(git diff --diff-filter=d --name-only $old $new -- '*.hs'))
if [[ ! -r tags ]] || [[ ! -r TAGS ]]
then
- $mktags "$BIZ_ROOT"/**/*
+ $mktags "$CODEROOT"/**/*
elif [[ ${#changed[@]} -gt 0 ]]
then
$mktags $changed
diff --git a/Biz/Ide/hooks/post-merge b/Biz/Ide/hooks/post-merge
index f0d59a9..c21211f 100755
--- a/Biz/Ide/hooks/post-merge
+++ b/Biz/Ide/hooks/post-merge
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
-exec ${BIZ_ROOT:?}/Biz/Ide/hooks/post-checkout 'HEAD@{1}' HEAD
+exec ${CODEROOT:?}/Biz/Ide/hooks/post-checkout 'HEAD@{1}' HEAD
diff --git a/Biz/Ide/hooks/pre-commit b/Biz/Ide/hooks/pre-commit
index 065a0f6..2b4575c 100755
--- a/Biz/Ide/hooks/pre-commit
+++ b/Biz/Ide/hooks/pre-commit
@@ -7,7 +7,7 @@
changed=($(git diff-index --cached --name-only HEAD))
for ns in ${changed[@]}
do
- version=$(${BIZ_ROOT:?}/Biz/Ide/version $ns)
+ version=$(${CODEROOT:?}/Biz/Ide/version $ns)
if (( $version == -1 )); then
echo "info: version: $ns: deleted"
elif (( $version < 1 )); then
diff --git a/Biz/Ide/hooks/pre-push b/Biz/Ide/hooks/pre-push
index baf7a13..0c313cb 100755
--- a/Biz/Ide/hooks/pre-push
+++ b/Biz/Ide/hooks/pre-push
@@ -30,7 +30,7 @@
fi
fi
##
- if lint "${BIZ_ROOT:?}"/**/*
+ if lint "${CODEROOT:?}"/**/*
then
lint_result="good"
else
@@ -38,7 +38,7 @@
exit 1
fi
##
- if bild --test "${BIZ_ROOT:?}"/**/*
+ if bild --test "${CODEROOT:?}"/**/*
then
test_result="good"
else
diff --git a/Biz/Ide/mktags b/Biz/Ide/mktags
index b984fb1..c83f319 100755
--- a/Biz/Ide/mktags
+++ b/Biz/Ide/mktags
@@ -4,17 +4,17 @@
#
set -euo pipefail
files=$@
- vimtags=${BIZ_ROOT:?}/tags
- emacstags=${BIZ_ROOT:?}/TAGS
+ vimtags=${CODEROOT:?}/tags
+ emacstags=${CODEROOT:?}/TAGS
#
if [[ ! -r $emacstags ]]; then
echo Generating emacs TAGS from scratch...
- fast-tags -e -R ${BIZ_ROOT:?}
+ fast-tags -e -R ${CODEROOT:?}
ctags -e \
--append=yes \
--recurse=yes \
- --exclude="$BIZ_ROOT/_/*" \
- ${BIZ_ROOT:?}
+ --exclude="$CODEROOT/_/*" \
+ ${CODEROOT:?}
else
fast-tags -e $files
ctags -e \
@@ -25,12 +25,12 @@
#
if [[ ! -r $vimtags ]]; then
echo Generating vim tags from scratch...
- fast-tags "${flags[@]}" -R ${BIZ_ROOT:?}
+ fast-tags "${flags[@]}" -R ${CODEROOT:?}
ctags "${flags[@]}" \
--append=yes \
--recurse=yes \
- --exclude="${BIZ_ROOT:?}/_/*" \
- ${BIZ_ROOT:?}
+ --exclude="${CODEROOT:?}/_/*" \
+ ${CODEROOT:?}
else
fast-tags "${flags[@]}" $files
ctags "${flags[@]}" \
diff --git a/Biz/Ide/ns b/Biz/Ide/ns
index c32b5d2..e988bfe 100755
--- a/Biz/Ide/ns
+++ b/Biz/Ide/ns
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
set -euo pipefail
-fd --exclude=_ -t f . ${BIZ_ROOT:?} | sed "s,${BIZ_ROOT:?}/*,,g" \
+fd --exclude=_ -t f . ${CODEROOT:?} | sed "s,${CODEROOT:?}/*,,g" \
| fzf \
--bind "alt-space:execute(bild {} && read -p [fin])" \
--bind "alt-enter:execute(vim {})" \
diff --git a/Biz/Ide/push b/Biz/Ide/push
index c4bfb72..2238e06 100755
--- a/Biz/Ide/push
+++ b/Biz/Ide/push
@@ -2,14 +2,14 @@
# Eventually convert to haskell, see:
# - https://github.com/awakesecurity/nix-deploy/blob/master/src/Main.hs
# - http://www.haskellforall.com/2018/08/nixos-in-production.html
-prefix=$(echo $PWD | sed -e "s|^${BIZ_ROOT:?}/*||g")
+prefix=$(echo $PWD | sed -e "s|^${CODEROOT:?}/*||g")
if [[ "$prefix" == "" ]]
then
target="$1"
else
target="$prefix.$1"
fi
-what=$(realpath "${BIZ_ROOT:?}/_/nix/$target")
+what=$(realpath "${CODEROOT:?}/_/nix/$target")
# hack: get the domain from the activation script. there does not seem
# to be a way to get it from nix-instantiate
where=$(rg -r '$2' -e '(domainname ")(.*)(")' "$what/activate")
diff --git a/Biz/Ide/repl b/Biz/Ide/repl
index 1401218..7230edd 100755
--- a/Biz/Ide/repl
+++ b/Biz/Ide/repl
@@ -31,7 +31,7 @@ fi
exts=$(jq --raw-output '.[].namespace.ext' <<< $json | sort | uniq)
packageSet=$(jq --raw-output '.[].packageSet' <<< $json)
module=$(jq --raw-output '.[].mainModule' <<< $json)
- BILD="(import ${BIZ_ROOT:?}/Biz/Bild.nix {})"
+ BILD="(import ${CODEROOT:?}/Biz/Bild.nix {})"
for lib in ${sysdeps[@]}; do
flags+=(--packages "$BILD.pkgs.${lib}")
flags+=(--packages "$BILD.pkgs.pkg-config")
@@ -46,14 +46,14 @@ fi
echo "warn: repl: ghci does not support binding to a port"
fi
flags+=(--packages "$BILD.bild.haskell.ghcWith (h: with h; [$langdeps])")
- command=${CMD:-"ghci -i${BIZ_ROOT:?} -ghci-script ${BIZ_ROOT:?}/.ghci ${targets[@]}"}
+ command=${CMD:-"ghci -i${CODEROOT:?} -ghci-script ${CODEROOT:?}/.ghci ${targets[@]}"}
;;
Scm)
for lib in ${langdeps[@]}; do
flags+=(--packages "$BILD.guile-${lib}")
done
flags+=(--packages "$BILD.guile")
- command=${CMD:-"guile -L ${BIZ_ROOT:?} -C ${BIZ_ROOT:?}/_/int --r7rs --listen=${PORT:-37146}"}
+ command=${CMD:-"guile -L ${CODEROOT:?} -C ${CODEROOT:?}/_/int --r7rs --listen=${PORT:-37146}"}
;;
Lisp)
flags+=(--packages "$BILD.bild.$packageSet (p: with p; [asdf swank $langdeps])")
@@ -67,8 +67,8 @@ fi
langdeps="$langdeps mypy"
flags+=(--packages ruff)
flags+=(--packages "$BILD.bild.python.pythonWith (p: with p; [$langdeps])")
- PYTHONPATH=$BIZ_ROOT:$PYTHONPATH
- pycommand="python -i $BIZ_ROOT/Biz/Repl.py $module ${targets[@]}"
+ PYTHONPATH=$CODEROOT:$PYTHONPATH
+ pycommand="python -i $CODEROOT/Biz/Repl.py $module ${targets[@]}"
command=${CMD:-"$pycommand"}
;;
*)
diff --git a/Biz/Ide/run b/Biz/Ide/run
index bf35e3e..f7b9d36 100755
--- a/Biz/Ide/run
+++ b/Biz/Ide/run
@@ -3,4 +3,4 @@ set -eu
target=$1
shift
out=$(rg --only-matching ": out (\w*)" -r '$1' $target)
-exec "${BIZ_ROOT:?}/_/bin/$out" "$@"
+exec "${CODEROOT:?}/_/bin/$out" "$@"
diff --git a/Biz/Ide/ship b/Biz/Ide/ship
index f817d29..33197c8 100755
--- a/Biz/Ide/ship
+++ b/Biz/Ide/ship
@@ -9,9 +9,9 @@
stuff=(${@})
if [[ ${#stuff[@]} -eq 0 ]]
then
- stuff=$(fd -t l . "$BIZ_ROOT/_" \
+ stuff=$(fd -t l . "$CODEROOT/_" \
| fzf --multi \
- | sed "s,$BIZ_ROOT/_/nix/,,g"
+ | sed "s,$CODEROOT/_/nix/,,g"
)
fi
lint ${stuff[@]}
diff --git a/Biz/Ide/tidy b/Biz/Ide/tidy
index edea828..ec666ba 100755
--- a/Biz/Ide/tidy
+++ b/Biz/Ide/tidy
@@ -1,2 +1,2 @@
#!/usr/bin/env bash
-rm -f $BIZ_ROOT/_/bin/*
+rm -f $CODEROOT/_/bin/*