daml/.envrc
Stefano Baghino d999a21ac3
Replace cd .. && pwd with readlink -f (#17152)
The output of `cd` might be altered by `CDPATH` set on a
system, leading to `dade` being broken because it cannot
read the current path. Instead, using `readlink -f` seem
to get the job done without side effects.
2023-07-19 12:54:33 +00:00

22 lines
1.1 KiB
Plaintext

echo "[dev-env] Setting up DA Development Environment"
eval "$(dev-env/bin/dade assist)"
DADE_PRE_COMMIT_HOOK_TYPE=pre-push
# Load private overrides
[[ -f .envrc.private ]] && source_env .envrc.private
if [ -n "${ARTIFACTORY_USERNAME:-}" ] && [ -n "${ARTIFACTORY_PASSWORD:-}" ]; then
export ARTIFACTORY_AUTH=$(echo -n "$ARTIFACTORY_USERNAME:$ARTIFACTORY_PASSWORD" | base64 -w0)
fi
# always start from a clean slate to ensure that the install phase produces the scenario described by `DADE_NO_PRE_COMMIT` and `DADE_PRE_COMMIT_HOOK_TYPE`
# this is a bit unfortunate but it doesn't look like pre-commit currently supports uninstalling all hooks in one go as of version 2.20.0
HOOK_TYPES=(pre-commit pre-merge-commit pre-push prepare-commit-msg commit-msg post-checkout post-commit post-merge post-rewrite)
for HOOK_TYPE in ${HOOK_TYPES[@]}; do pre-commit uninstall -t "$HOOK_TYPE" > /dev/null; done
# install pre-commit hook (opt-out by setting `DADE_NO_PRE_COMMIT`, set the hook type with `DADE_PRE_COMMIT_HOOK_TYPE` -- defaults to 'pre-push')
if [[ -z "${DADE_NO_PRE_COMMIT:-}" ]]; then
pre-commit install -t "$DADE_PRE_COMMIT_HOOK_TYPE" > /dev/null
fi