From 7d8cbe36469732877276c53cc12384b74a6e771e Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 13 Oct 2023 16:16:54 -0400 Subject: [PATCH 1/3] Adds 'just all' and 'just fix'. --- justfile | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/justfile b/justfile index ff32ff651..c831a1758 100644 --- a/justfile +++ b/justfile @@ -1,3 +1,4 @@ +alias a := all alias b := build alias c := clean alias co := cover @@ -40,6 +41,7 @@ _uid_args := if os_family() == "unix" { "" } +# Quick start default: #!/usr/bin/env bash set -eou pipefail @@ -49,6 +51,29 @@ default: just web just build +# Executes commands where avaiable. WARNING your mileage may very. +all *args: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + if $(cd web/ && just --show {{ args }} &>/dev/null); then + just web {{ args }} + fi + + if $(just --show {{ args }} &>/dev/null); then + just {{ args }} + fi + + if $(cd test/bats && just --show {{ args }} &>/dev/null); then + just bats {{ args }} + fi + + if $(cd test/cy && just --show {{ args }} &>/dev/null); then + just cy {{ args }} + fi + + # Executes commands in ./test/bats/justfile. Equivalent to `just test/bats/`, but inside of Docker (i.e., just _with_docker just test/bats/). bats *args: #!/usr/bin/env bash @@ -97,6 +122,14 @@ executable-path: just _with_docker echo '$(./scripts/get-executable-path.bash {{ _cmd }} $(just version) $(go env GOHOSTOS) $(go env GOHOSTARCH))' +# Fixes linting errors +fix: + #!/usr/bin/env bash + set -eou pipefail + {{ _with_debug }} + + ./scripts/ccheck.py ./scripts/ccheck.config --fix + # Build the image. Typically does not need to be done very often. image: #!/usr/bin/env bash From a2566eecd96f28e970d6f9e9391d5e21ba47a572 Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 13 Oct 2023 16:21:54 -0400 Subject: [PATCH 2/3] Adds aliases --- justfile | 2 +- test/bats/justfile | 4 ++++ test/cy/justfile | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/justfile b/justfile index c831a1758..b35e452bb 100644 --- a/justfile +++ b/justfile @@ -2,7 +2,7 @@ alias a := all alias b := build alias c := clean alias co := cover -alias i := image +alias im := image alias l := lint alias r := run alias t := test diff --git a/test/bats/justfile b/test/bats/justfile index 249f3163d..75b706375 100644 --- a/test/bats/justfile +++ b/test/bats/justfile @@ -1,3 +1,7 @@ +alias c := clean +alias i := install +alias t := test + _with_debug := if env_var_or_default("DEBUG", "true") == "true" { "set -x pipefail" } else { diff --git a/test/cy/justfile b/test/cy/justfile index 67198f146..bcef43c14 100644 --- a/test/cy/justfile +++ b/test/cy/justfile @@ -1,3 +1,7 @@ +alias c := clean +alias i := install +alias t := test + _with_debug := if env_var_or_default("DEBUG", "true") == "true" { "set -x pipefail" } else { From 42c65fc5d5dfb3397aa2421e47bc213c4d19e9e6 Mon Sep 17 00:00:00 2001 From: tdstein Date: Fri, 13 Oct 2023 20:41:55 -0400 Subject: [PATCH 3/3] Fixes 'just all' default execution --- justfile | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/justfile b/justfile index b35e452bb..09c3befce 100644 --- a/justfile +++ b/justfile @@ -51,28 +51,19 @@ default: just web just build -# Executes commands where avaiable. WARNING your mileage may very. -all *args: +# Executes command against every justfile where avaiable. WARNING your mileage may very. +all +args='default': #!/usr/bin/env bash set -eou pipefail {{ _with_debug }} - if $(cd web/ && just --show {{ args }} &>/dev/null); then - just web {{ args }} - fi - - if $(just --show {{ args }} &>/dev/null); then - just {{ args }} - fi - - if $(cd test/bats && just --show {{ args }} &>/dev/null); then - just bats {{ args }} - fi - - if $(cd test/cy && just --show {{ args }} &>/dev/null); then - just cy {{ args }} - fi - + # For each justfile, check if the first argument exists, and then execute it. + for f in `find . -name justfile`; do + arg=`echo {{ args }} | awk '{print $1;}'` + if just -f $f --show $arg &>/dev/null; then + just _with_docker just -f $f {{ args }} + fi + done # Executes commands in ./test/bats/justfile. Equivalent to `just test/bats/`, but inside of Docker (i.e., just _with_docker just test/bats/). bats *args: