diff options
| author | mail_redacted_for_web | 2026-04-19 12:12:48 +0200 |
|---|---|---|
| committer | mail_redacted_for_web | 2026-04-19 12:12:48 +0200 |
| commit | de89bc2666d41474764a36b930940b72322d6c54 (patch) | |
| tree | 626d68d43c2ba32a00fe0473789797c4a866e824 /.bash/aliases.bash | |
| parent | 1998c2e12d19cc8cb739a5bdacf88386afdf5d0a (diff) | |
| download | dotfiles-de89bc2666d41474764a36b930940b72322d6c54.tar.bz2 | |
feat: function for updating user installations of several language extensions
Diffstat (limited to '.bash/aliases.bash')
| -rw-r--r-- | .bash/aliases.bash | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/.bash/aliases.bash b/.bash/aliases.bash index a09ba54..76fb793 100644 --- a/.bash/aliases.bash +++ b/.bash/aliases.bash @@ -251,6 +251,56 @@ fi # ...yeah, I'm mostly doing ruby stuff for Puppet, erm I mean # OpenVox (now that Perforce have turned the Puppet world to a burning heap of garbage) alias bake="bundle exec rake" +# ----- SOFTWARE MGMT ----- # +# We may want to avoid having old $things[] running on our machine. While package managers +# should be the absolute priority, there may be things like Ruby gems, Python packages, +# Rust crates which we may need especially on anything other than an Arch machine. +# Define a function that runs all updates. +# This does not care about isolated venv/bundle/whatnot directories, it maintains +# the installations in the standard user home folders explicitly. +# DANGER: this may lead to breaking changes in one language while the others still perform +# fine. +function update-user-extensions { + mystrt='\033[38;2;23;147;209m' + mywarn='\033[38;5;178m' + mydone='\033[38;5;71m' + myrset='\033[0m' + # Ruby / user's gems + if [ -x '/usr/bin/gem' ]; then + printf '%bRuby (through gem)%b\n' "$mystrt" "$myrset" + # We expect a file ~/.config/usergems with one gem per line. + # Found no way yet to determine --user-installed gems, let alone + # those explicitly installed (vs. dependency-only). + if [ -r "${HOME}/.config/usergems" ]; then + while read -r gem; do + gem update "$gem" --user-install || exit 110 + done < <(cat "${HOME}/.config/usergems") + else + printf '%b%b not found, not updating gems.%b\n' "$mywarn" "${HOME}/.config/usergems" "$myrset" >&2 + fi + printf '%bdone.%b\n' "$mydone" "$myrset" + else + printf '%b/usr/bin/gem not found, not updating Ruby user installations.%b\n' "$mywarn" "$myrset" + fi + # pipx for Python + if [ -x '/usr/bin/pipx' ]; then + printf '%bPython (through pipx)%b\n' "$mystrt" "$myrset" + pipx list --short || exit 111 + pipx upgrade-all || exit 112 + printf '%bdone.%b\n' "$mydone" "$myrset" + else + printf '%b/usr/bin/pipx not found, not updating Python user installations.%b\n' "$mywarn" "$myrset" + fi + # Rust / user's crates + if [ -x '/usr/bin/cargo' ]; then + printf '%bRust (through cargo)%b\n' "$mystrt" "$myrset" + # For this to work, a user must have run 'cargo install cargo-update' at least once. + cargo install-update --all || exit 113 + printf '%bdone.%b\n' "$mydone" "$myrset" + else + printf '%b/usr/bin/cargo not found, not updating Rust user installations.%b\n' "$mywarn" "$myrset" + fi +} # ----- OTHER STUFF ----- # for cmmd in batcat bat; do if command -v "$cmmd" > /dev/null; then |
