diff --git a/dot_config/profile/profile.d/functions.sh.tmpl b/dot_config/profile/profile.d/functions.sh.tmpl index 3aca6b4..ee1035e 100644 --- a/dot_config/profile/profile.d/functions.sh.tmpl +++ b/dot_config/profile/profile.d/functions.sh.tmpl @@ -27,6 +27,26 @@ go_deps() ( awk 'NR>'"${START_AT}"' && NR<'"${END_AT}"' {print $1}' "${GO_MOD}" ) +#{{ if lookPath "gem" -}} +#{{ if lookPath "dasel" -}} +#{{ if lookPath "jq" -}} +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}"'"]' + 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' + fi +) +#{{- end }} +#{{- end }} +#{{- end }} + make_script() ( cat <<-EOF > "${1}" #!/usr/bin/env bash diff --git a/dot_config/profile/profile.d/hellotech.sh.tmpl b/dot_config/profile/profile.d/hellotech.sh.tmpl index b795822..2e5517f 100644 --- a/dot_config/profile/profile.d/hellotech.sh.tmpl +++ b/dot_config/profile/profile.d/hellotech.sh.tmpl @@ -23,5 +23,13 @@ _add_path () { _add_path "/usr/local/opt/mysql-client/bin" _add_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 #{{- end }}