diff --git a/Changelog.md b/Changelog.md index 03935a0..0164fd4 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## [v0.2.X] - 2025- ### Added - App management file for [xan](https://github.com/medialab/xan) +- App management file for [auth0](https://github.com/auth0/auth0-cli), see #21 ## [v0.2.3.1] - 2025-04-01 ### Fixed diff --git a/README.md b/README.md index 7aabb1f..db54acc 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,7 @@ In alphabetical order: Name | Description :--- | :--- +[auth0](https://github.com/auth0/auth0-cli) | Build, manage and test your Auth0 integrations from the command line [bat](https://github.com/sharkdp/bat) | A cat(1) clone with syntax highlighting and Git integration [borg](https://www.borgbackup.org/) | Deduplicating archiver with compression and authenticated encryption [broot](https://github.com/Canop/broot) | A new way to see and navigate directory trees diff --git a/lib/sdd/apps/user/auth0 b/lib/sdd/apps/user/auth0 new file mode 100644 index 0000000..2fbcb4e --- /dev/null +++ b/lib/sdd/apps/user/auth0 @@ -0,0 +1,26 @@ +#!/usr/bin/env bash + +sdd_install() { + local version=$1 + local version_no_v + # Strip prefixed v from version number for package name + version_no_v=$(echo "$version" | tr -d v) + local package=auth0-cli_${version_no_v}_Linux_x86_64 + local archive="$package".tar.gz + wget -P /tmp https://github.com/auth0/auth0-cli/releases/download/"$version"/"$archive" + + cd /tmp || return 1 + tar xfv "$archive" + mv auth0 "$SDD_INSTALL_PREFIX"/bin/auth0 + "$SDD_INSTALL_PREFIX"/bin/auth0 completion bash > "$SDD_BASH_COMPLETION_DIR"/auth0 + rm -rfv "$archive" +} + +sdd_uninstall() { + rm -fv "$SDD_INSTALL_PREFIX"/bin/auth0 + rm -fv "$SDD_BASH_COMPLETION_DIR"/auth0 +} + +sdd_fetch_latest_version() { + _tag_name_of_latest_github_release auth0 auth0-cli +} diff --git a/test/apps/auth0.bats b/test/apps/auth0.bats new file mode 100644 index 0000000..e796eaf --- /dev/null +++ b/test/apps/auth0.bats @@ -0,0 +1,18 @@ +@test "auth0 of recent version can be installed and uninstalled" { + run sdd install auth0 + [ $status -eq 0 ] + [[ "${lines[0]}" = 'Latest version available: '* ]] + [ "${lines[-1]}" = 'Succeeded to install "auth0".' ] + + run auth0 --version + [ $status -eq 0 ] + + [ -f ~/.local/share/bash-completion/completions/auth0 ] + + run sdd uninstall auth0 + [ $status -eq 0 ] + [ "${lines[-1]}" = 'Succeeded to uninstall "auth0".' ] + + run which auth0 + [ $status -eq 1 ] +}