Skip to content

Commit

Permalink
Stop running rbenv-doctor automatically after rbenv-installer
Browse files Browse the repository at this point in the history
Since it's likely that PATH is not configured yet, rbenv-doctor will
often fail, making the user feel like they've done something wrong.

Fixes #23
  • Loading branch information
mislav committed May 3, 2021
1 parent f7db934 commit e649078
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 25 deletions.
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,7 @@ wget -q https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-installer

## rbenv-doctor

After the installation, a separate `rbenv-doctor` script is run to verify the
success of the installation and to detect common issues. You can run
`rbenv-doctor` on your machine separately to verify the state of your install:
You can verify the state of your rbenv installation with:

```sh
# with curl
Expand Down
36 changes: 14 additions & 22 deletions bin/rbenv-installer
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ if ! type -p git >/dev/null; then
}
fi

http() {
local url="$1"
if type -p curl >/dev/null; then
curl -fsSL "$url"
elif type -p wget >/dev/null; then
wget -q "$url" -O-
else
echo "Error: couldn't download file. No \`curl' or \`wget' found." >&2
return 1
fi
}

rbenv="$(command -v rbenv ~/.rbenv/bin/rbenv | head -1)"

if [ -n "$rbenv" ]; then
Expand All @@ -40,9 +28,8 @@ if [ -n "$rbenv" ]; then
if [ -x ./brew ]; then
echo "Trying to update with Homebrew..."
brew update >/dev/null
if [ "$(./rbenv --version)" < "1.0.0" ] && brew list rbenv | grep -q rbenv/HEAD; then
brew uninstall rbenv
brew install rbenv
if brew list rbenv | grep -q rbenv/HEAD; then
brew reinstall rbenv
else
brew upgrade rbenv
fi
Expand Down Expand Up @@ -105,17 +92,22 @@ fi
# Enable caching of rbenv-install downloads
mkdir -p "${rbenv_root}/cache"

echo
echo "Running doctor script to verify installation..."
http https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | "$BASH"

echo
echo "All done!"
echo "Note that this installer doesn't yet configure your shell startup files:"
echo "Note that this installer does NOT edit your shell configuration files:"
i=0
if [ -x ~/.rbenv/bin ]; then
echo "$((++i)). You'll want to ensure that \`~/.rbenv/bin' is added to PATH."
fi
echo "$((++i)). Run \`rbenv init' to see instructions how to configure rbenv for your shell."
echo "$((++i)). Launch a new terminal window to verify that the configuration is correct."
echo "$((++i)). Run \`rbenv init' to view instructions on how to configure rbenv for your shell."
echo "$((++i)). Launch a new terminal window after editing shell configuration files."

url="https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor"
if false && type -p curl >/dev/null; then
echo "$((++i)). (Optional) Run the doctor command to verify the installation:"
printf ' curl -fsSL "%s" | bash\n' "$url"
elif type -p wget >/dev/null; then
echo "$((++i)). (Optional) Run the doctor command to verify the installation:"
printf ' wget -q "%s" -O- | bash\n' "$url"
fi
echo

0 comments on commit e649078

Please sign in to comment.