From a090bc6b47ce88116558862784c953df74226fa8 Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Wed, 14 Aug 2024 09:45:40 -0700 Subject: [PATCH] Update configs to include file and update versions --- dot_bashrc.tmpl | 39 ++++++++++--------- dot_config/bash/bashrc.d/completion.sh.tmpl | 8 ++-- dot_config/profile/profile.d/base.sh.tmpl | 6 --- .../profile/profile.d/functions.sh.tmpl | 15 +++---- .../profile/profile.d/hellotech.sh.tmpl | 18 +++------ dot_local/bin/executable_install-buf | 2 +- dot_local/bin/executable_install-deno | 2 +- dot_local/bin/executable_install-dust | 2 +- .../bin/executable_install-go-grpc-gateway | 2 +- dot_local/bin/executable_install-go-home | 2 +- dot_local/bin/executable_install-go-system | 2 +- .../bin/executable_install-golangci-lint | 2 +- dot_local/bin/executable_install-jira | 2 +- .../bin/executable_install-protoc-gen-go-grpc | 2 +- dot_local/bin/executable_install-protoc-home | 2 +- .../bin/executable_install-protoc-system | 2 +- dot_local/bin/executable_install-sqlc | 2 +- dot_local/bin/executable_install-templ | 2 +- dot_profile.tmpl | 30 +++++--------- dot_zshrc => dot_zshrc.tmpl | 18 ++++----- 20 files changed, 66 insertions(+), 94 deletions(-) rename dot_zshrc => dot_zshrc.tmpl (53%) diff --git a/dot_bashrc.tmpl b/dot_bashrc.tmpl index e0dcca1..6f57553 100644 --- a/dot_bashrc.tmpl +++ b/dot_bashrc.tmpl @@ -14,23 +14,24 @@ if [[ -f "${XDG_CONFIG_HOME}/bash/prompt.sh" ]]; then fi #{{- end }} -if [ -d "${XDG_CONFIG_HOME}"/bash/bashrc.d ]; then - for file in "${XDG_CONFIG_HOME}"/bash/bashrc.d/*.sh; do - if [ -r "$file" ]; then - #shellcheck disable=1090 - source "$file" - fi - done - unset file -fi +#{{- $home := .chezmoi.homeDir }} +#{{ range $file := (glob (joinPath $home ".config" "bash" "bashrc.d" "*.sh")) }} +source "#{{ replace $home "${HOME}" $file }}" +#{{- end }} -if [[ -d "${XDG_CONFIG_HOME}/bash/env.d" ]]; then - for file in "${XDG_CONFIG_HOME}"/bash/env.d/*.env; do - eval "$( - grep -v '^\s*\#' "${file}" | - grep -v '^\s*$' | - sed 's/^\s*export//g' | - sed 's/^/export /g' - )" - done -fi +_env_file () { + if [ ! -f "${1}" ]; then + return + fi + eval "$( + grep -v '^\s*\#' "${1}" | + grep -v '^\s*$' | + sed 's/^\s*export//g' | + sed 's/^/export /g' + )" +} +#{{ range $file := (glob (joinPath $home ".config" "bash" "env.d" "*.env")) }} +_env_file "#{{ replace $home "${HOME}" $file }}" +#{{- end }} + +unset _env_file diff --git a/dot_config/bash/bashrc.d/completion.sh.tmpl b/dot_config/bash/bashrc.d/completion.sh.tmpl index 407611c..cd4eeae 100644 --- a/dot_config/bash/bashrc.d/completion.sh.tmpl +++ b/dot_config/bash/bashrc.d/completion.sh.tmpl @@ -38,7 +38,7 @@ source <(starship init bash) #{{ end -}} #{{ if lookPath "direnv" -}} -eval "$(direnv hook bash)" +source <(direnv hook bash) #{{ end -}} #{{ if lookPath "erd" -}} @@ -47,13 +47,11 @@ eval "$(direnv hook bash)" #{{ end -}} #{{ if lookPath "trubka" -}} -eval "$(trubka --completion-script-bash)" +source <(trubka --completion-script-bash) #{{ end -}} #{{ if lookPath "rbenv" -}} -if [ "${RBENV_SHELL}" = "" ]; then - eval "$(rbenv init -)" -fi +source <(rbenv init -) #{{ end -}} #{{ if and (lookPath "rvm") (stat (joinPath .chezmoi.homeDir ".rvm" "bin") ) -}} diff --git a/dot_config/profile/profile.d/base.sh.tmpl b/dot_config/profile/profile.d/base.sh.tmpl index 81eaa01..bbdbbaa 100644 --- a/dot_config/profile/profile.d/base.sh.tmpl +++ b/dot_config/profile/profile.d/base.sh.tmpl @@ -18,12 +18,6 @@ if [ -f "${HOME}/.cargo/env" ]; then fi #{{- end }} -#{{- if lookPath "rbenv" }} -if [ "${RBENV_SHELL}" = "" ]; then - eval "$(rbenv init -)" -fi -#{{- end }} - #{{- if lookPath "rvm" }} if [ -d "${HOME}/.rvm/bin" ]; then case "${PATH}" in diff --git a/dot_config/profile/profile.d/functions.sh.tmpl b/dot_config/profile/profile.d/functions.sh.tmpl index ee1035e..0487afd 100644 --- a/dot_config/profile/profile.d/functions.sh.tmpl +++ b/dot_config/profile/profile.d/functions.sh.tmpl @@ -33,16 +33,17 @@ go_deps() ( gem_env () ( NAME=${1:-} if [ "$NAME" != '' ]; then - gem environment \ - | dasel --read yaml --write json \ - | jq '.["RubyGems Environment"] | to_entries | map((.value | keys)[0] as $key | {key: $key, value: .value[$key] }) | from_entries' \ - | jq --raw-output '.["'"${NAME}"'"]' + gem_env_json | jq --raw-output '.["'"${NAME}"'"]' else - gem environment \ - | dasel --read yaml --write json \ - | jq '.["RubyGems Environment"] | to_entries | map((.value | keys)[0] as $key | {key: $key, value: .value[$key] }) | from_entries' + gem_env_json fi ) + +gem_env_json () ( + gem environment \ + | dasel --read yaml --write json \ + | jq '.["RubyGems Environment"] | to_entries | map((.value | keys)[0] as $key | {key: $key, value: .value[$key] }) | from_entries' +) #{{- end }} #{{- end }} #{{- end }} diff --git a/dot_config/profile/profile.d/hellotech.sh.tmpl b/dot_config/profile/profile.d/hellotech.sh.tmpl index 2e5517f..c2448dc 100644 --- a/dot_config/profile/profile.d/hellotech.sh.tmpl +++ b/dot_config/profile/profile.d/hellotech.sh.tmpl @@ -9,7 +9,7 @@ k8s_last_config () ( | bat --language yaml ) -_add_path () { +_append_path () { if [ ! -d "$1" ]; then return fi @@ -17,19 +17,11 @@ _add_path () { *"$1"*) return ;; *) ;; esac - PATH="${PATH}:$1" + PATH="${PATH}:${1}" } -_add_path "/usr/local/opt/mysql-client/bin" -_add_path "${HOME}/google-cloud-sdk/bin" +_append_path "/usr/local/opt/mysql-client/bin" +_append_path "${HOME}/google-cloud-sdk/bin" -#{{ if lookPath "gem" -}} -#{{ if lookPath "dasel" -}} -#{{ if lookPath "jq" -}} -_add_path "$(gem_env "USER INSTALLATION DIRECTORY")/bin" -#{{- end }} -#{{- end }} -#{{- end }} - -unset _add_path +unset _append_path #{{- end }} diff --git a/dot_local/bin/executable_install-buf b/dot_local/bin/executable_install-buf index bc26903..8f6cc7f 100755 --- a/dot_local/bin/executable_install-buf +++ b/dot_local/bin/executable_install-buf @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -VERSION=${VERSION:-v1.34.0} +VERSION=${VERSION:-v1.36.0} DEST=${XDG_DATA_HOME}/apps/releases/buf CURRENT=${DEST}/current URL=https://github.com/bufbuild/buf/releases/download/${VERSION}/buf-$(uname)-$(uname -m).tar.gz diff --git a/dot_local/bin/executable_install-deno b/dot_local/bin/executable_install-deno index 7f8be58..df78804 100755 --- a/dot_local/bin/executable_install-deno +++ b/dot_local/bin/executable_install-deno @@ -16,7 +16,7 @@ function get_os () ( APP=deno -VERSION=${VERSION:-1.44.4} +VERSION=${VERSION:-1.45.5} DEST=${XDG_DATA_HOME}/apps/releases/${APP} URL=https://github.com/denoland/deno/releases/download/v${VERSION}/deno-$(uname -m)-$(get_os).zip diff --git a/dot_local/bin/executable_install-dust b/dot_local/bin/executable_install-dust index 68793f7..d796d49 100755 --- a/dot_local/bin/executable_install-dust +++ b/dot_local/bin/executable_install-dust @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=dust -VERSION=${VERSION:-1.0.0} +VERSION=${VERSION:-1.1.1} DEST=${XDG_DATA_HOME}/apps/releases/${APP} main() ( diff --git a/dot_local/bin/executable_install-go-grpc-gateway b/dot_local/bin/executable_install-go-grpc-gateway index ef0a23c..bb7b685 100755 --- a/dot_local/bin/executable_install-go-grpc-gateway +++ b/dot_local/bin/executable_install-go-grpc-gateway @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -VERSION=${VERSION:-2.20.0} +VERSION=${VERSION:-2.21.0} DEST="${XDG_DATA_HOME}/apps/releases/protoc-grpc-gateway" BASE_URL=https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${VERSION} GRPC_GATEWAY_URL=${BASE_URL}/protoc-gen-grpc-gateway-v${VERSION}-$(get_os)-$(uname -m) diff --git a/dot_local/bin/executable_install-go-home b/dot_local/bin/executable_install-go-home index 87283cd..c44e43a 100755 --- a/dot_local/bin/executable_install-go-home +++ b/dot_local/bin/executable_install-go-home @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=go -VERSION=${VERSION:-1.22.4} +VERSION=${VERSION:-1.23.0} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" URL=https://dl.google.com/go/go${VERSION}.$(get_os)-$(get_arch).tar.gz diff --git a/dot_local/bin/executable_install-go-system b/dot_local/bin/executable_install-go-system index a7604a3..753b4b7 100755 --- a/dot_local/bin/executable_install-go-system +++ b/dot_local/bin/executable_install-go-system @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1090 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -VERSION=${VERSION:-1.22.4} +VERSION=${VERSION:-1.23.0} DEST=/usr/local/apps/golang URL=https://dl.google.com/go/go${VERSION}.$(get_os)-$(get_arch).tar.gz DEST_BIN=$DEST/current/bin diff --git a/dot_local/bin/executable_install-golangci-lint b/dot_local/bin/executable_install-golangci-lint index fb22cbd..34b551f 100755 --- a/dot_local/bin/executable_install-golangci-lint +++ b/dot_local/bin/executable_install-golangci-lint @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=golangci-lint -VERSION=${VERSION:-1.59.1} +VERSION=${VERSION:-1.60.1} DEST="${XDG_DATA_HOME}/apps/releases/${APP}" URL=https://github.com/golangci/golangci-lint/releases/download/v${VERSION}/golangci-lint-${VERSION}-$(get_os)-$(get_arch).tar.gz diff --git a/dot_local/bin/executable_install-jira b/dot_local/bin/executable_install-jira index 8a33ab7..2849797 100755 --- a/dot_local/bin/executable_install-jira +++ b/dot_local/bin/executable_install-jira @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=jira -VERSION=${VERSION:-1.4.0} +VERSION=${VERSION:-1.5.1} DEST=${XDG_DATA_HOME}/apps/releases/${APP} main() ( diff --git a/dot_local/bin/executable_install-protoc-gen-go-grpc b/dot_local/bin/executable_install-protoc-gen-go-grpc index e723415..e6e49ee 100755 --- a/dot_local/bin/executable_install-protoc-gen-go-grpc +++ b/dot_local/bin/executable_install-protoc-gen-go-grpc @@ -1,4 +1,4 @@ #!/usr/bin/env bash -VERSION=${VERSION:-v1.3.0} +VERSION=${VERSION:-v1.5.1} go install "google.golang.org/grpc/cmd/protoc-gen-go-grpc@${VERSION}" diff --git a/dot_local/bin/executable_install-protoc-home b/dot_local/bin/executable_install-protoc-home index caab9ad..dc431f9 100755 --- a/dot_local/bin/executable_install-protoc-home +++ b/dot_local/bin/executable_install-protoc-home @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -VERSION=${VERSION:-27.2} +VERSION=${VERSION:-27.3} APP=protoc APPS_DIR=${XDG_DATA_HOME}/apps/releases/${APP} VER_DIR=${APPS_DIR}/${VERSION} diff --git a/dot_local/bin/executable_install-protoc-system b/dot_local/bin/executable_install-protoc-system index ad746c6..7ee78ab 100755 --- a/dot_local/bin/executable_install-protoc-system +++ b/dot_local/bin/executable_install-protoc-system @@ -5,7 +5,7 @@ set -euo pipefail # shellcheck disable=SC1091 source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" -PROTOC_VERSION=${VERSION:-27.2} +PROTOC_VERSION=${VERSION:-27.3} PROTOC_ZIP=protoc-$PROTOC_VERSION-linux-x86_64.zip TMP_DIR=$(mktemp --directory) DEST_FILE=$TMP_DIR/$PROTOC_ZIP diff --git a/dot_local/bin/executable_install-sqlc b/dot_local/bin/executable_install-sqlc index 8b4b38e..1f990c2 100755 --- a/dot_local/bin/executable_install-sqlc +++ b/dot_local/bin/executable_install-sqlc @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=sqlc -VERSION=${VERSION:-1.26.0} +VERSION=${VERSION:-1.27.0} DEST=${XDG_DATA_HOME}/apps/releases/${APP} URL=https://downloads.sqlc.dev/sqlc_${VERSION}_$(get_os)_$(get_arch).tar.gz diff --git a/dot_local/bin/executable_install-templ b/dot_local/bin/executable_install-templ index a001583..800d6b9 100755 --- a/dot_local/bin/executable_install-templ +++ b/dot_local/bin/executable_install-templ @@ -6,7 +6,7 @@ set -euo pipefail source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" APP=templ -VERSION=${VERSION:-v0.2.707} +VERSION=${VERSION:-v0.2.747} DEST=${XDG_DATA_HOME}/apps/releases/${APP} URL=https://github.com/a-h/templ/releases/download/${VERSION}/templ_$(uname)_$(uname -m).tar.gz diff --git a/dot_profile.tmpl b/dot_profile.tmpl index eb4441e..620a805 100644 --- a/dot_profile.tmpl +++ b/dot_profile.tmpl @@ -31,7 +31,7 @@ if [ "${XDG_RUNTIME_DIR}" = "" ]; then fi #{{- end }} -env_file () { +_env_file () { if [ ! -f "${1}" ]; then return fi @@ -43,23 +43,13 @@ env_file () { )" } -env_file "${XDG_CONFIG_HOME}/user-dirs.dirs" - -if [ -d "${XDG_CONFIG_HOME}/profile/env.d" ]; then - for file in "${XDG_CONFIG_HOME}"/profile/env.d/*.env; do - env_file "${file}" - done - unset file -fi - -unset env_file +#{{ $home := .chezmoi.homeDir -}} +_env_file "${XDG_CONFIG_HOME}/user-dirs.dirs" +#{{- range $file := (glob (joinPath $home ".config" "profile" "env.d" "*.env")) }} +_env_file "#{{ replace $home "${HOME}" $file }}" +#{{- end }} -if [ -d "${XDG_CONFIG_HOME}/profile/profile.d" ]; then - for file in "${XDG_CONFIG_HOME}"/profile/profile.d/*.sh; do - if [ -r "$file" ]; then - #shellcheck disable=1090 - . "$file" - fi - done - unset file -fi +unset _env_file +#{{ range $file := (glob (joinPath $home ".config" "profile" "profile.d" "*.sh")) }} +. "#{{ replace $home "${HOME}" $file }}" +#{{- end }} diff --git a/dot_zshrc b/dot_zshrc.tmpl similarity index 53% rename from dot_zshrc rename to dot_zshrc.tmpl index 3e65f0e..9386eae 100644 --- a/dot_zshrc +++ b/dot_zshrc.tmpl @@ -1,3 +1,6 @@ +# chezmoi:template:left-delimiter=#{{ +#{{- /* vim: set filetype=zsh: */ -}} + if [[ -d "${XDG_CONFIG_HOME}/zsh/env.d" ]]; then for file in "${XDG_CONFIG_HOME}"/zsh/env.d/*.env(N); do eval "$( @@ -10,14 +13,7 @@ if [[ -d "${XDG_CONFIG_HOME}/zsh/env.d" ]]; then unset file fi -if [[ -d "${XDG_CONFIG_HOME}/zsh/zshrc.d" ]]; then - for file in "${XDG_CONFIG_HOME}"/zsh/zshrc.d/*.zsh(N); do - if [ -r "$file" ]; then - #shellcheck disable=1090 - source "$file" - fi - done - unset file -fi - -# vim: ft=zsh +#{{- $home := .chezmoi.homeDir }} +#{{ range $file := (glob (joinPath $home ".config" "zsh" "zshrc.d" "*.zsh")) }} +source "#{{ replace $home "${HOME}" $file }}" +#{{- end }}