rbenv-doctor
Shell command-substitution syntaxShell syntax tree exceeds 1000 nodes
SHA-2569ecc3c18b328d84f1e014fa6ce3f3fdc4a6f5ca8cdd160435ef27209222b6b4b
MaleculeK(Am)H₆(CmDb₂F₂OsPo₃U)Md(Pt)
Evidence
1#!/bin/bash
2# Usage: rbenv doctor
3# Summary: Detects common problems in rbenv installation
4
5set -e
6[ -n "$RBENV_DEBUG" ] && set -x
7
8count-lines() {
9 printf "%d" "$(wc -l)"
10}
11
⋯6 lines
18 local path
19 while read -r path; do
20 readlink -f "$path" 2>/dev/null || printf "%s\n" "$path"
21 done | uniq
22}
⋯9 lines
53:4… olor_reset=""
54fi
55
56warnings=0
57
58echo -n "Checking for \`rbenv' in PATH: "
59num_locations="$(command-list rbenv | deduplicate-paths | count-lines)"
60if [ "$num_locations" -eq 0 ]; then
61 printc red "not found"
62 echo
63 { if [ -x ~/.rbenv/bin/rbenv ]; then
64 echo "You seem to have rbenv installed in \`$HOME/.rbenv/bin', but that"
65 echo "directory is not present in PATH. Please add it to PATH by configuring"
66 echo "your shell initialization files."
67 else
68 echo "Please refer to https://github.com/rbenv/rbenv#installation"
69 fi
70 } | indent
71 exit 1
72elif [ "$num_locations" -eq 1 ]; then
73 printc green "$(command -v rbenv)"
74 echo
75else
76 printc yellow "multiple"
77 echo
78 { echo "You seem to have multiple rbenv installs in the following locations."
79 echo "Please pick just one installation and remove the others."
80 echo
81 command-list rbenv
82 } | indent
83 echo
84 : $((warnings++))
85fi
86
87RBENV_ROOT="${RBENV_ROOT:-$(rbenv root)}"
88
89echo -n "Checking for rbenv shims in PATH: "
90shims_dir="${RBENV_ROOT}/shims"
91found=""
92precedence_problem=""
93IFS=: read -r -a path <<<"$PATH" || true
94for dir in "${path[@]}"; do
95 if [ "$dir" = "$shims_dir" ]; then
96 found=true
97 elif [ -x "$dir"/ruby ] && [ -z "$found" ]; t …
165:6… atest_version="$(rbenv install -l 2>/dev/null | grep -vFe - | tail -1)"
166 [ -n "$latest_version" ] || latest_version="<version>"
167 echo -n "You …