Compare commits

...

3 Commits

Author SHA1 Message Date
CanbiZ (MickLesk) e97657b0c8 Fix comment formatting in tools.func 2026-07-16 13:51:05 +02:00
CanbiZ (MickLesk) 9cbfeb1b7d Refactor Ruby version installation script 2026-07-16 13:50:14 +02:00
CanbiZ (MickLesk) bd4870a542 tools.func: enhance rbenv with profile updates / bundle in bashrc
Added checks to update shell profile files for rbenv integration and removed redundant profile setup code.
2026-07-16 13:45:54 +02:00
+19
View File
@@ -8677,6 +8677,7 @@ setup_postgresql_db() {
export PG_DB_USER export PG_DB_USER
export PG_DB_PASS export PG_DB_PASS
} }
# ------------------------------------------------------------------------------ # ------------------------------------------------------------------------------
# Installs rbenv and ruby-build, installs Ruby and optionally Rails. # Installs rbenv and ruby-build, installs Ruby and optionally Rails.
# #
@@ -8696,8 +8697,26 @@ setup_ruby() {
local RBENV_DIR="$HOME/.rbenv" local RBENV_DIR="$HOME/.rbenv"
local RBENV_BIN="$RBENV_DIR/bin/rbenv" local RBENV_BIN="$RBENV_DIR/bin/rbenv"
local PROFILE_FILE="$HOME/.profile" local PROFILE_FILE="$HOME/.profile"
local BASH_PROFILE_FILE="$HOME/.bash_profile"
local BASHRC_FILE="$HOME/.bashrc"
local TMP_DIR=$(mktemp -d) local TMP_DIR=$(mktemp -d)
if ! grep -q 'rbenv init' "$PROFILE_FILE" 2>/dev/null; then
cat <<'EOF' >>"$PROFILE_FILE"
export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"
EOF
fi
if ! grep -q '.rbenv/shims' "$PROFILE_FILE" 2>/dev/null; then
echo 'export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"' >>"$PROFILE_FILE"
fi
if [[ -f "$BASH_PROFILE_FILE" ]] && ! grep -q '.rbenv/shims' "$BASH_PROFILE_FILE"; then
echo 'export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"' >>"$BASH_PROFILE_FILE"
fi
if [[ -f "$BASHRC_FILE" ]] && ! grep -q '.rbenv/shims' "$BASHRC_FILE"; then
echo 'export PATH="$HOME/.rbenv/shims:$HOME/.rbenv/bin:$PATH"' >>"$BASHRC_FILE"
fi
# Get currently installed Ruby version # Get currently installed Ruby version
local CURRENT_RUBY_VERSION="" local CURRENT_RUBY_VERSION=""
if [[ -x "$RBENV_BIN" ]]; then if [[ -x "$RBENV_BIN" ]]; then