Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Improved the install script for working with docker containers and CI/CD pipelines.
Changes
Here's a rationale for each change:
set -eo pipefail instead of just set -e:
Makes the script more robust by failing if any part of a pipeline fails, not just the last command. Helpful for catching errors in commands like
curl
orsh
Added BASE_DIR="${XDG_CONFIG_HOME:-$HOME}":
Follows XDG Base Directory Specification. You can see this that follows foundry's more recent improvements. It respects user preferences for config locations, instead of just dropping right into $HOME
Changed CYFRIN_DIR="$HOME/.cyfrin" to CYFRIN_DIR="${CYFRIN_DIR:-"$BASE_DIR/.cyfrin"}":
Allows users to customize installation directory via environment variable
Changed .zshrc to .zshenv and added ${ZDOTDIR-"$HOME"}:
.zshenv
is loaded for all shell types (interactive, non-interactive, login, scripts), whereas.zshrc
is only loaded for interactive shells, meaning it won't be loaded for scripts, Docker containers, or other non-interactive environments where PATH modifications might be needed.Added ash shell support:
Matches Foundry's shell support
Added Fish shell-specific PATH modification:
Matches Foundry's shell support
Added immediate PATH export:
Makes the tool immediately available in current session so that we can use it in a docker environment where each shell is dropped between commands.
How to test
Dockerfile
filedocker build -t cyfrin-dev .
This is the error:
It will work successfully.
Testing tear down
You'll have a new docker image in your docker daemon, you can remove it if you'd like.