daml/dev-env/bin/dade-prepare-for-update
Digital Asset GmbH 05e691f558 open-sourcing daml
2019-04-04 09:33:38 +01:00

44 lines
1.1 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# This script prepares the user's machine for significant updates
# in the dev-env by checking out the "dev-env-next" branch if it exists,
# and installing new Nix version (if any) and running "dade-preload".
#
set -e
# Switch to the directory containing this script, to make sure
# we're within the repository for the git commands.
cd "$(dirname "${BASH_SOURCE[0]}")"
# Create a temporary directory, and set up cleanup after exit.
PREPTEMP="$(mktemp -d)"
function cleanup() {
rm -rf "$PREPTEMP"
}
trap cleanup EXIT
# Clone dev-env-next branch, from GitHub, using the local repository
# as reference.
echo "Checking out 'dev-env-next'..."
echo "------------------------------"
git clone --depth 1 --branch dev-env-next \
--reference "$(git rev-parse --show-toplevel)" \
"git@github.com:DACH-NY/da" \
"$PREPTEMP/da"
cd "$PREPTEMP/da"
source dev-env/profile_bash.sh
# Run dade-init to upgrade Nix if needed.
echo
echo "Running dade-init..."
echo "--------------------"
dade-init
# Run dade-preload to pull all dev-env tools.
echo
echo "Running dade-preload..."
echo "-----------------------"
dade-preload