Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helpful install message #1501

Open
sandstrom opened this issue Apr 19, 2023 · 3 comments
Open

Helpful install message #1501

sandstrom opened this issue Apr 19, 2023 · 3 comments

Comments

@sandstrom
Copy link

sandstrom commented Apr 19, 2023

It would be great if the "version x.y.z is not installed" message could be extended, explaining how to install the required version.

AFAIK running rbenv install should solve the problem.

I think this is the relevant source:

RBENV_PREFIX_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}"
if [ ! -d "$RBENV_PREFIX_PATH" ]; then
echo "rbenv: version \`${RBENV_VERSION}' not installed" >&2
exit 1
fi

Possible solution

Perhaps something like this could work:

RBENV_PREFIX_PATH="${RBENV_ROOT}/versions/${RBENV_VERSION}"
if [ ! -d "$RBENV_PREFIX_PATH" ]; then
  echo "rbenv: version \`${RBENV_VERSION}' not installed" >&2
  echo "rbenv: you can try installing it with 'rbenv install ${RBENV_VERSION}'" >&2
  exit 1
fi

Examples of this problem

This gist contains a lot of comments on this topic (to illustrate that I'm not the only one with this issue).

https://gist.github.com/esteedqueen/b605cdf78b0060299322033b6a60afc3

@jasonkarns
Copy link
Member

Seems like it could be helpful; though it's worth considering that rbenv install may not be available. rbenv-install is provided by ruby-build when installed as an rbenv plugin. But ruby-build is optional and not required for rbenv to work. Which means the rbenv install command isn't guaranteed to exist.

@sandstrom
Copy link
Author

Seems like it could be helpful; though it's worth considering that rbenv install may not be available. rbenv-install is provided by ruby-build when installed as an rbenv plugin. But ruby-build is optional and not required for rbenv to work. Which means the rbenv install command isn't guaranteed to exist.

Good point! Should gate on that script being installed. Since it would be an additive message, it's not a problem if that wouldn't be shown to everyone.

@mislav
Copy link
Member

mislav commented May 8, 2023

I'm open to this! Thanks for the proposal and thanks @jasonkarns for pointing out the important gotcha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants