|
44 | 44 | git remote add -f -t master origin https://github.com/rbenv/rbenv.git
|
45 | 45 | git checkout -b master origin/master
|
46 | 46 | rbenv=~/.rbenv/bin/rbenv
|
47 |
| - |
48 |
| - if [ ! -e versions ] && [ -w /opt/rubies ]; then |
49 |
| - ln -s /opt/rubies versions |
50 |
| - fi |
51 | 47 | fi
|
52 | 48 | fi
|
53 | 49 |
|
|
82 | 78 | # Enable caching of rbenv-install downloads
|
83 | 79 | mkdir -p "${rbenv_root}/cache"
|
84 | 80 |
|
| 81 | +# Detect the type of shell that invoked the installer: |
| 82 | +shell="$(ps -p "$PPID" -o 'args=' 2>/dev/null || true)" |
| 83 | +shell="${shell%% *}" |
| 84 | +shell="${shell##-}" |
| 85 | +shell="${shell:-$SHELL}" |
| 86 | +shell="${shell##*/}" |
| 87 | + |
| 88 | +case "$shell" in |
| 89 | +bash | zsh| ksh | ksh93 | mksh | fish ) |
| 90 | + # allow known shells to be configured |
| 91 | + ;; |
| 92 | +* ) |
| 93 | + # default to bash in case the parent process is not a known shell |
| 94 | + shell=bash |
| 95 | + ;; |
| 96 | +esac |
| 97 | + |
85 | 98 | echo
|
86 |
| -echo "All done!" |
87 |
| -echo "Note that this installer does NOT edit your shell configuration files:" |
88 |
| -i=0 |
89 |
| -rbenv_command="rbenv" |
90 |
| -if [ -x ~/.rbenv/bin ]; then |
91 |
| - # shellcheck disable=SC2088 |
92 |
| - rbenv_command='~/.rbenv/bin/rbenv' |
93 |
| -fi |
94 |
| -echo "$((++i)). Run \`$rbenv_command init' to view instructions on how to configure rbenv for your shell." |
95 |
| -echo "$((++i)). Launch a new terminal window after editing shell configuration files." |
| 99 | +echo "Setting up your shell with \`rbenv init $shell' ..." |
| 100 | +"$rbenv" init "$shell" |
96 | 101 |
|
97 |
| -url="https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-doctor" |
98 |
| -if false && type -p curl >/dev/null; then |
99 |
| - echo "$((++i)). (Optional) Run the doctor command to verify the installation:" |
100 |
| - printf ' curl -fsSL "%s" | bash\n' "$url" |
101 |
| -elif type -p wget >/dev/null; then |
102 |
| - echo "$((++i)). (Optional) Run the doctor command to verify the installation:" |
103 |
| - printf ' wget -q "%s" -O- | bash\n' "$url" |
104 |
| -fi |
105 | 102 | echo
|
| 103 | +echo "All done! After reloading your terminal window, rbenv should be good to go." |
0 commit comments