mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-03-03 15:00:02 +00:00
feat(scripts): add shellspec installation to dfm (#296)
* feat(scripts): add shellspec installation to dfm Add install-shellspec.sh script that clones shellspec to ~/.cache/shellspec and installs via make to ~/.local/bin. Wire it into dfm install menu and the Tier 4 install-all pipeline. * fix(scripts): address PR review feedback for shellspec installer Add companion install-shellspec.md documentation file to match codebase convention. Add --depth=1 to git pull for consistent shallow clone behavior. * fix(scripts): pin shellspec install to latest release tag Use x-gh-get-latest-version to fetch the latest release tag from GitHub and clone/checkout that specific version. Addresses supply chain concern and normalizes --depth=1 style. * docs(scripts): update shellspec docs to reflect release-tag pinning
This commit is contained in:
@@ -88,6 +88,7 @@ section_install()
|
|||||||
"nvm-latest:Install latest lts node using nvm"
|
"nvm-latest:Install latest lts node using nvm"
|
||||||
"nvm:Install Node Version Manager (nvm)"
|
"nvm:Install Node Version Manager (nvm)"
|
||||||
"python-packages:Install Python packages via uv"
|
"python-packages:Install Python packages via uv"
|
||||||
|
"shellspec:Install shellspec testing framework"
|
||||||
"xcode-cli-tools:Install Xcode CLI tools (macOS)"
|
"xcode-cli-tools:Install Xcode CLI tools (macOS)"
|
||||||
"z:Install z"
|
"z:Install z"
|
||||||
)
|
)
|
||||||
@@ -121,6 +122,7 @@ section_install()
|
|||||||
$0 install ntfy
|
$0 install ntfy
|
||||||
|
|
||||||
# Tier 4: Independent utilities
|
# Tier 4: Independent utilities
|
||||||
|
$0 install shellspec
|
||||||
$0 install z
|
$0 install z
|
||||||
|
|
||||||
msgr msg "Reloading configurations again..."
|
msgr msg "Reloading configurations again..."
|
||||||
@@ -245,6 +247,12 @@ section_install()
|
|||||||
&& msgr yay "Xcode CLI tools installed!"
|
&& msgr yay "Xcode CLI tools installed!"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
shellspec)
|
||||||
|
msgr run "Installing shellspec..."
|
||||||
|
bash "$DOTFILES/scripts/install-shellspec.sh" \
|
||||||
|
&& msgr yay "shellspec has been installed!"
|
||||||
|
;;
|
||||||
|
|
||||||
z)
|
z)
|
||||||
msgr run "Installing z..."
|
msgr run "Installing z..."
|
||||||
bash "$DOTFILES/scripts/install-z.sh" \
|
bash "$DOTFILES/scripts/install-z.sh" \
|
||||||
|
|||||||
16
scripts/install-shellspec.md
Normal file
16
scripts/install-shellspec.md
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
# install-shellspec
|
||||||
|
|
||||||
|
Installs [shellspec](https://github.com/shellspec/shellspec), a BDD-style
|
||||||
|
testing framework for shell scripts.
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
```bash
|
||||||
|
scripts/install-shellspec.sh
|
||||||
|
```
|
||||||
|
|
||||||
|
The script resolves the latest release tag via `x-gh-get-latest-version`,
|
||||||
|
clones shellspec to `~/.cache/shellspec` pinned to that tag, and runs
|
||||||
|
`make install PREFIX=$HOME/.local`, placing the binary in `~/.local/bin/`.
|
||||||
|
Re-running the script fetches and checks out the newest release tag
|
||||||
|
before reinstalling.
|
||||||
37
scripts/install-shellspec.sh
Executable file
37
scripts/install-shellspec.sh
Executable file
@@ -0,0 +1,37 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -euo pipefail
|
||||||
|
# @description Install shellspec testing framework
|
||||||
|
#
|
||||||
|
# shellcheck source=shared.sh
|
||||||
|
source "${DOTFILES}/config/shared.sh"
|
||||||
|
|
||||||
|
SHELLSPEC_REPO="https://github.com/shellspec/shellspec.git"
|
||||||
|
SHELLSPEC_CACHE="$HOME/.cache/shellspec"
|
||||||
|
|
||||||
|
install_shellspec()
|
||||||
|
{
|
||||||
|
local version
|
||||||
|
version=$(x-gh-get-latest-version shellspec/shellspec)
|
||||||
|
msgr ok "Latest shellspec version: $version"
|
||||||
|
|
||||||
|
if [[ -d "$SHELLSPEC_CACHE" ]]; then
|
||||||
|
msgr ok "shellspec repo already cloned, fetching $version..."
|
||||||
|
git -C "$SHELLSPEC_CACHE" fetch --depth=1 origin "refs/tags/$version"
|
||||||
|
git -C "$SHELLSPEC_CACHE" checkout "$version"
|
||||||
|
else
|
||||||
|
git clone --branch "$version" --depth=1 "$SHELLSPEC_REPO" "$SHELLSPEC_CACHE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
msgr run "Running make install..."
|
||||||
|
make -C "$SHELLSPEC_CACHE" install PREFIX="$HOME/.local"
|
||||||
|
msgr run_done "shellspec $version installed to $HOME/.local/bin/shellspec"
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main()
|
||||||
|
{
|
||||||
|
install_shellspec
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
main "$@"
|
||||||
Reference in New Issue
Block a user