Skip to content

Commit

Permalink
use denv v1.1.0's quiet no-overwrite init flags
Browse files Browse the repository at this point in the history
this simplifies just init for newer denv and avoids a confusing error
message that is usually just passed by
  • Loading branch information
tomeichlersmith committed Nov 5, 2024
1 parent 34d43a5 commit 1124190
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -102,18 +102,28 @@ debug config_py *ARGS:
# initialize a containerized development environment
init:
#!/usr/bin/env sh
# while setting the denv_workspace is helpful for other
# commands that can assume the denv is already initialized,
# we need to unset this environment variable to make sure
# the test is done appropriately.
# just makes sure this recipe runs from the directory of
# the justfile so we know we are in the correct location.
unset denv_workspace
if denv check --workspace --quiet; then
echo "\033[32mWorkspace already initialized.\033[0m"
denv config print
denv_major=$(denv version | sed 's/denv v//' | cut -f 1 -d.)
denv_minor=$(denv version | set 's/denv v//' | cut -f 2 -d.)
if [ "${denv_major}" -lt 1 ] || [ "${denv_minor}" -lt "1" ]; then
# denv v1.0.X or earlier, manually check for workspace
# which may print a confusing error from denv when no workspace is found
unset denv_workspace
# while setting the denv_workspace is helpful for other
# commands that can assume the denv is already initialized,
# we need to unset this environment variable to make sure
# the test is done appropriately.
# just makes sure this recipe runs from the directory of
# the justfile so we know we are in the correct location.
if denv check --workspace --quiet; then
echo "\033[32mWorkspace already initialized.\033[0m"
denv config print
else
denv init --clean-env --name ldmx ldmx/dev:latest ${LDMX_BASE}
fi
else
denv init --clean-env --name ldmx ldmx/dev:latest ${LDMX_BASE}
# denv v1.1.0 and later has updated denv init to allow us
# to avoid overwriting quietly
denv init --clean-env --no-over --no-mkdir --name ldmx ldmx/dev:latest ${LDMX_BASE}
fi
# check that the necessary programs for running ldmx-sw are present
Expand Down

0 comments on commit 1124190

Please sign in to comment.