diff --git a/README.md b/README.md index bd23fe1..b7f0e1b 100644 --- a/README.md +++ b/README.md @@ -27,6 +27,7 @@ | [delta](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/delta) | `delta` — syntax-highlighting pager for git diffs | gh release | 1.0.0 | | [deno.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/deno.com) | `deno` — secure TypeScript/JavaScript runtime | curl | 1.0.0 | | [devenv.sh](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/devenv.sh) | `devenv` — reproducible developer environments via Nix | nix | 1.0.0 | +| [direnv.net](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/direnv.net) | `direnv` — environment switcher that loads and unloads variables based on the current directory | apt | 1.0.0 | | [diffity.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/diffity.com) | `diffity` — agent-agnostic GitHub-style diff viewer and code review tool | npm | 1.0.0 | | [dolthub.com](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/dolthub.com) | `dolt` — SQL database with Git-style versioning | gh release | 1.0.0 | | [dolthub.com/doltgres](https://github.com/devcontainer-community/devcontainer-features/tree/main/src/dolthub.com-doltgres) | `doltgres` — version-controlled PostgreSQL-compatible database | gh release | 1.0.0 | diff --git a/src/direnv.net/NOTES.md b/src/direnv.net/NOTES.md new file mode 100644 index 0000000..231f196 --- /dev/null +++ b/src/direnv.net/NOTES.md @@ -0,0 +1,17 @@ +# direnv.net + +## Project + +- [direnv](https://direnv.net/) + +## Description + +An environment switcher for the shell. `direnv` loads and unloads environment variables based on the current directory, allowing per-project environment configuration via `.envrc` files. + +## Installation Method + +Installed via the system APT package manager (`apt-get install direnv`). + +## Other Notes + +_No additional notes._ diff --git a/src/direnv.net/devcontainer-feature.json b/src/direnv.net/devcontainer-feature.json new file mode 100644 index 0000000..d716c10 --- /dev/null +++ b/src/direnv.net/devcontainer-feature.json @@ -0,0 +1,17 @@ +{ + "name": "direnv.net", + "id": "direnv.net", + "version": "1.0.0", + "description": "Install \"direnv\" binary", + "documentationURL": "https://github.com/devcontainer-community/devcontainer-features/tree/main/src/direnv.net", + "options": { + "version": { + "type": "string", + "default": "latest", + "proposals": [ + "latest" + ], + "description": "Currently unused. direnv is installed via the system package manager." + } + } +} diff --git a/src/direnv.net/install.sh b/src/direnv.net/install.sh new file mode 100755 index 0000000..25a919f --- /dev/null +++ b/src/direnv.net/install.sh @@ -0,0 +1,35 @@ +#!/bin/bash +set -o errexit +set -o pipefail +set -o noclobber +set -o nounset +set -o allexport +readonly name="direnv" +apt_get_update() { + if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then + echo "Running apt-get update..." + apt-get update -y + fi +} +apt_get_checkinstall() { + if ! dpkg -s "$@" >/dev/null 2>&1; then + apt_get_update + DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends --no-install-suggests --option 'Debug::pkgProblemResolver=true' --option 'Debug::pkgAcquire::Worker=1' "$@" + fi +} +apt_get_cleanup() { + apt-get clean + rm -rf /var/lib/apt/lists/* +} +echo_banner() { + local text="$1" + echo -e "\e[1m\e[97m\e[41m$text\e[0m" +} +install() { + apt_get_checkinstall direnv + apt_get_cleanup +} +echo_banner "devcontainer.community" +echo "Installing $name..." +install "$@" +echo "(*) Done!" diff --git a/test/direnv.net/test.sh b/test/direnv.net/test.sh new file mode 100755 index 0000000..8e3c551 --- /dev/null +++ b/test/direnv.net/test.sh @@ -0,0 +1,18 @@ +#!/bin/bash + + +set -e + +# Optional: Import test library bundled with the devcontainer CLI +# See https://github.com/devcontainers/cli/blob/HEAD/docs/features/test.md#dev-container-features-test-lib +# Provides the 'check' and 'reportResults' commands. +source dev-container-features-test-lib + +# Feature-specific tests +# The 'check' command comes from the dev-container-features-test-lib. Syntax is... +# check