From ff610b482f2b10f4498d006a79359ff6e942bae6 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 14 Jan 2025 12:27:28 +0100 Subject: [PATCH 1/3] add version number, display using --version --- foundryup/foundryup | 48 ++++++++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/foundryup/foundryup b/foundryup/foundryup index 714ad9aa29734..4d72eefefbaf9 100755 --- a/foundryup/foundryup +++ b/foundryup/foundryup @@ -1,6 +1,11 @@ #!/usr/bin/env bash set -eo pipefail +# NOTE: if you make modifications to this script, please increment the version number. +# Major / minor: incremented for each stable release of Foundry. +# Patch: incremented for each change between stable releases. +FOUNDRYUP_INSTALLER_VERSION="0.3.0" + BASE_DIR=${XDG_CONFIG_HOME:-$HOME} FOUNDRY_DIR=${FOUNDRY_DIR:-"$BASE_DIR/.foundry"} FOUNDRY_VERSIONS_DIR="$FOUNDRY_DIR/versions" @@ -23,6 +28,8 @@ main() { case $1 in --) shift; break;; + -v|--version) shift; version;; + -U|--update) shift; update;; -r|--repo) shift; FOUNDRYUP_REPO=$1;; -b|--branch) shift; FOUNDRYUP_BRANCH=$1;; -i|--install) shift; FOUNDRYUP_VERSION=$1;; @@ -32,7 +39,6 @@ main() { -P|--pr) shift; FOUNDRYUP_PR=$1;; -C|--commit) shift; FOUNDRYUP_COMMIT=$1;; -j|--jobs) shift; FOUNDRYUP_JOBS=$1;; - -U|--update) shift; update;; --arch) shift; FOUNDRYUP_ARCH=$1;; --platform) shift; FOUNDRYUP_PLATFORM=$1;; -h|--help) @@ -71,7 +77,7 @@ main() { # Ignore branches/versions as we do not want to modify local git state if [ -n "$FOUNDRYUP_REPO" ] || [ -n "$FOUNDRYUP_BRANCH" ] || [ -n "$FOUNDRYUP_VERSION" ]; then - warn "--branch, --version, and --repo arguments are ignored during local install" + warn "--branch, --install, and --repo arguments are ignored during local install" fi # Enter local repo and build @@ -256,6 +262,8 @@ USAGE: OPTIONS: -h, --help Print help information + -v, --version Print the version of foundryup + -U, --update Update foundryup to the latest version -i, --install Install a specific version from built binaries -l, --list List versions installed from built binaries -u, --use Use a specific installed version from built binaries @@ -265,12 +273,31 @@ OPTIONS: -r, --repo Build and install from a remote GitHub repo (uses default branch if no other options are set) -p, --path Build and install a local repository -j, --jobs Number of CPUs to use for building Foundry (default: all CPUs) - -U, --update Update foundryup to the latest version --arch Install a specific architecture (supports amd64 and arm64) --platform Install a specific platform (supports win32, linux, and darwin) EOF } +version() { + echo "foundryup $FOUNDRYUP_INSTALLER_VERSION" + exit 0 +} + +update() { + say "updating foundryup..." + + # Download to a temporary file first + tmp_file="$(mktemp)" + ensure download "$FOUNDRY_BIN_URL" "$tmp_file" + + # Replace the current foundryup with the downloaded file + ensure mv "$tmp_file" "$FOUNDRY_BIN_PATH" + ensure chmod +x "$FOUNDRY_BIN_PATH" + + say "successfully updated foundryup" + exit 0 +} + list() { if [ -d "$FOUNDRY_VERSIONS_DIR" ]; then for VERSION in $FOUNDRY_VERSIONS_DIR/*; do @@ -309,21 +336,6 @@ use() { fi } -update() { - say "updating foundryup..." - - # Download to a temporary file first - tmp_file="$(mktemp)" - ensure download "$FOUNDRY_BIN_URL" "$tmp_file" - - # Replace the current foundryup with the downloaded file - ensure mv "$tmp_file" "$FOUNDRY_BIN_PATH" - ensure chmod +x "$FOUNDRY_BIN_PATH" - - say "successfully updated foundryup" - exit 0 -} - say() { printf "foundryup: %s\n" "$1" } From a2127dc773692d756d7fc20b2d58b031474eb712 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 14 Jan 2025 12:29:31 +0100 Subject: [PATCH 2/3] use say instead of echo --- foundryup/foundryup | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foundryup/foundryup b/foundryup/foundryup index 4d72eefefbaf9..998abfeb1ae07 100755 --- a/foundryup/foundryup +++ b/foundryup/foundryup @@ -77,7 +77,7 @@ main() { # Ignore branches/versions as we do not want to modify local git state if [ -n "$FOUNDRYUP_REPO" ] || [ -n "$FOUNDRYUP_BRANCH" ] || [ -n "$FOUNDRYUP_VERSION" ]; then - warn "--branch, --install, and --repo arguments are ignored during local install" + warn "--branch, --install, --use, and --repo arguments are ignored during local install" fi # Enter local repo and build @@ -279,7 +279,7 @@ EOF } version() { - echo "foundryup $FOUNDRYUP_INSTALLER_VERSION" + say "$FOUNDRYUP_INSTALLER_VERSION" exit 0 } From 0adc592c05f6df29c7b267e6c3ee997e2314ac40 Mon Sep 17 00:00:00 2001 From: zerosnacks Date: Tue, 14 Jan 2025 12:44:26 +0100 Subject: [PATCH 3/3] add input box for foundryup version to bug template --- .github/ISSUE_TEMPLATE/BUG-FORM.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/ISSUE_TEMPLATE/BUG-FORM.yml b/.github/ISSUE_TEMPLATE/BUG-FORM.yml index b2575134d782d..5a5f7e7808994 100644 --- a/.github/ISSUE_TEMPLATE/BUG-FORM.yml +++ b/.github/ISSUE_TEMPLATE/BUG-FORM.yml @@ -32,6 +32,10 @@ body: attributes: label: What version of Foundry are you on? placeholder: "Run forge --version and paste the output here" + - type: input + attributes: + label: What version of Foundryup are you on? + placeholder: "Run foundryup --version and paste the output here" - type: input attributes: label: What command(s) is the bug in? @@ -51,4 +55,4 @@ body: label: Describe the bug description: Please include relevant Solidity snippets as well if relevant. validations: - required: true + required: true \ No newline at end of file