mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-07-17 19:35:08 +02:00
tools.func: enhance rbenv with profile updates / bundle in bashrc (#15822)
* 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. * Refactor Ruby version installation script * Fix comment formatting in tools.func
This commit is contained in:
committed by
GitHub
parent
373ae7e143
commit
7c7d40cfe3
@@ -8689,6 +8689,7 @@ setup_postgresql_db() {
|
||||
export PG_DB_USER
|
||||
export PG_DB_PASS
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Installs rbenv and ruby-build, installs Ruby and optionally Rails.
|
||||
#
|
||||
@@ -8708,8 +8709,26 @@ setup_ruby() {
|
||||
local RBENV_DIR="$HOME/.rbenv"
|
||||
local RBENV_BIN="$RBENV_DIR/bin/rbenv"
|
||||
local PROFILE_FILE="$HOME/.profile"
|
||||
local BASH_PROFILE_FILE="$HOME/.bash_profile"
|
||||
local BASHRC_FILE="$HOME/.bashrc"
|
||||
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
|
||||
local CURRENT_RUBY_VERSION=""
|
||||
if [[ -x "$RBENV_BIN" ]]; then
|
||||
|
||||
Reference in New Issue
Block a user