From fb8e9ac54dd7e294aa76e1bb6c128a4b6b88652e Mon Sep 17 00:00:00 2001 From: Buddy Sandidge Date: Tue, 17 May 2022 16:22:39 -0700 Subject: [PATCH] Add rvm support and ruby package --- ruby/.config/bash/bashrc.d/rvm.sh | 7 +++++++ ruby/.config/profile/profile.d/rvm.sh | 15 ++++++++++++++ ruby/.config/zsh/zshrc.d/rvm.zsh | 5 +++++ ruby/.local/bin/install-rvm | 29 +++++++++++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 ruby/.config/bash/bashrc.d/rvm.sh create mode 100644 ruby/.config/profile/profile.d/rvm.sh create mode 100644 ruby/.config/zsh/zshrc.d/rvm.zsh create mode 100755 ruby/.local/bin/install-rvm diff --git a/ruby/.config/bash/bashrc.d/rvm.sh b/ruby/.config/bash/bashrc.d/rvm.sh new file mode 100644 index 0000000..8d2d727 --- /dev/null +++ b/ruby/.config/bash/bashrc.d/rvm.sh @@ -0,0 +1,7 @@ +# shellcheck shell=bash +if [[ -d "${HOME}/.rvm/bin" ]]; then + # shellcheck disable=SC2076 + if [[ ! "${PATH}" =~ "${HOME}/.rvm/bin" ]]; then + export PATH="$PATH:$HOME/.rvm/bin" + fi +fi diff --git a/ruby/.config/profile/profile.d/rvm.sh b/ruby/.config/profile/profile.d/rvm.sh new file mode 100644 index 0000000..11c3dc1 --- /dev/null +++ b/ruby/.config/profile/profile.d/rvm.sh @@ -0,0 +1,15 @@ +# shellcheck shell=sh +if [ -d "${HOME}/.rvm/bin" ]; then + case "${PATH}" in + *"$HOME/.rvm/bin"*) ;; + *) export PATH="$PATH:$HOME/.rvm/bin" ;; + esac +fi + +if [ "$(ps -p $$ -ocomm=)" = sh ]; then + if [ -f "$HOME/.rvm/scripts/rvm" ]; then + # Load RVM into a shell session *as a function* + # shellcheck disable=SC1091 + . "$HOME/.rvm/scripts/rvm" + fi +fi diff --git a/ruby/.config/zsh/zshrc.d/rvm.zsh b/ruby/.config/zsh/zshrc.d/rvm.zsh new file mode 100644 index 0000000..3fd7bd0 --- /dev/null +++ b/ruby/.config/zsh/zshrc.d/rvm.zsh @@ -0,0 +1,5 @@ +if [[ -d "${HOME}/.rvm/bin" ]]; then + if [[ ! "${PATH}" =~ "${HOME}/.rvm/bin" ]]; then + export PATH="$PATH:$HOME/.rvm/bin" + fi +fi diff --git a/ruby/.local/bin/install-rvm b/ruby/.local/bin/install-rvm new file mode 100755 index 0000000..5d3a318 --- /dev/null +++ b/ruby/.local/bin/install-rvm @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -eo pipefail + +# shellcheck disable=SC1091 +source "${XDG_DATA_HOME}/buddy-up/includes/utils.sh" + +VERSION=${VERSION:-1.29.12} +APP=rvm-installer +DEST=${XDG_DATA_HOME}/apps/releases/${APP} +URL=https://raw.githubusercontent.com/rvm/rvm/${VERSION}/binscripts/rvm-installer + +RVM_KEYS="409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB" + +# shellcheck disable=SC2086 +gpg --recv-keys ${RVM_KEYS} + +mkdir_if_missing "${DEST}/${VERSION}" +INSTALLER=${DEST}/${VERSION}/rvm-installer + +if [[ ! -f "${INSTALLER}" ]]; then + curl --silent --location --output "${INSTALLER}" "${URL}" + chmod +x "${INSTALLER}" +fi + +set_current_link "${DEST}" "${VERSION}" +set_link "${XDG_BIN_HOME}/${APP}" "${DEST}" "${APP}" + +"${INSTALLER}" "${VERSION}"