-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
# Motivation We have the same code to install `didc` in 5 different places. # Changes 1. Add a script which can install `didc` on Mac or Linux. 2. Use it instead of the existing duplicated code. # Tests 1. Ran manually on MacOS. 2. CI passes using the new script. # Todos - [ ] Add entry to changelog (if necessary). not necessary
- Loading branch information
Showing
4 changed files
with
38 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#!/usr/bin/env bash | ||
set -euo pipefail | ||
|
||
SOURCE_DIR="$(dirname "$(realpath "${BASH_SOURCE[0]}")")" | ||
|
||
# Source the clap.bash file --------------------------------------------------- | ||
source "$SOURCE_DIR/clap.bash" | ||
# Define options | ||
clap.define short=r long=release desc="The didc release to install" variable=RELEASE default="pinned" | ||
# Source the output file ---------------------------------------------------------- | ||
source "$(clap.build)" | ||
|
||
if [[ "${RELEASE:-}" == "pinned" ]]; then | ||
RELEASE="$(jq -r '.defaults.build.config.DIDC_RELEASE' "$SOURCE_DIR/../dfx.json")" | ||
fi | ||
|
||
echo "Installing didc release $RELEASE" | ||
|
||
if [[ "$(uname)" == "Darwin" ]]; then | ||
echo "Installing MacOS version" | ||
DIDC_URL="https://github.com/dfinity/candid/releases/download/${RELEASE}/didc-macos" | ||
else | ||
echo "Installing Linux version" | ||
DIDC_URL="https://github.com/dfinity/candid/releases/download/${RELEASE}/didc-linux64" | ||
fi | ||
|
||
USER_BIN="$HOME/.local/bin" | ||
mkdir -p "$USER_BIN" | ||
tmpfile="$(mktemp)" | ||
curl -Lf "$DIDC_URL" >"$tmpfile" | ||
install -m 755 "$tmpfile" "$USER_BIN/didc" | ||
|
||
echo "Installed $("$USER_BIN/didc" --version)" |