Skip to content

Commit

Permalink
fix(ops): cross platform shell usage by platform
Browse files Browse the repository at this point in the history
  • Loading branch information
t3hmrman committed Mar 6, 2024
1 parent 5dfa213 commit cfa9bd0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions Justfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Choose sell based on platform
shell := if os() == "macos" { "zsh" } else { "bash" }

docker := env_var_or_default("DOCKER", "docker")
git := env_var_or_default("GIT", "git")
tar := env_var_or_default("TAR", "tar")
Expand Down Expand Up @@ -43,7 +46,7 @@ default:
###########

_check-installed-version tool msg:
#!/usr/bin/env -S zsh -euo pipefail
#!/usr/bin/env -S {{shell}} -euo pipefail
if [ -z "$(command -v {{tool}})" ]; then
echo "{{msg}}";
exit 1;
Expand Down Expand Up @@ -78,11 +81,11 @@ revision := env_var_or_default("REVISION", `git rev-parse --short HEAD`)
echo -n {{revision}}

print-version:
#!/usr/bin/env -S zsh -euo pipefail
#!/usr/bin/env -S {{shell}} -euo pipefail
echo -n `{{just}} get-version`

print-revision:
#!/usr/bin/env -S zsh -euo pipefail
#!/usr/bin/env -S {{shell}} -euo pipefail
echo -n `{{just}} get-revision`

print-pkg-output-dir:
Expand Down Expand Up @@ -123,7 +126,7 @@ test:
{{cargo}} pgrx test

pgrx-init:
#!/usr/bin/env -S zsh -euo pipefail
#!/usr/bin/env -S {{shell}} -euo pipefail
if [ ! -d "{{pkg_pg_config_path}}" ]; then
echo "failed to find pgrx init dir [{{pkg_pg_config_path}}], running pgrx init...";
{{cargo}} pgrx init
Expand Down Expand Up @@ -153,7 +156,7 @@ img_dockerfile_path := "infra" / "docker" / "pg_idkit-pg" + pg_image_version + "

# Ensure that that a given file is present
_ensure-file file:
#!/usr/bin/env -S zsh
#!/usr/bin/env -S {{shell}} -euo pipefail
if [ ! -f "{{file}}" ] ; then
echo "[error] file [{{file}}] is required, but missing";
exit 1;
Expand Down

0 comments on commit cfa9bd0

Please sign in to comment.