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

`rbenv version-name > .ruby-version` write `system` to file instead of current version #1065

Closed
ayqazi opened this Issue Jan 26, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@ayqazi

ayqazi commented Jan 26, 2018

My current global Ruby version is 2.5.0

rbenv version
=> 2.5.0 (set by /home/xxxx/.rbenv/version)

rbenv version-name
=> 2.5.0

However when I try to redirect that to a file, it outputs system!

rbenv version-name > .ruby-version
cat .ruby-version
=> system

This seems wrong.......

I'm currently on the master branch of rbenv. Commit ID as of now is b943955dbf10c436a8d4c7c36fd4216a34ef2b33.

Thanks

viclim added a commit to viclim/rbenv that referenced this issue Feb 26, 2018

Fix rbenv#1065
Command `rbenv version-name > .ruby-version` will create an empty `.ruby-version` file
before running `rbenv-version-file`. This causes `rbenv-version-file` to return empty
string which in turn causes `rbenv-version-name` to return `system`.

Ensure size of `.ruby-version` is non-zero as a workaround.
@viclim

This comment has been minimized.

Contributor

viclim commented Feb 26, 2018

@ayqazi

I created a PR to address the issue you're having.

In the meantime, use the builtin method instead.

rbenv local $(rbenv version-name)
# or simply
rbenv local 2.5.0

@mislav mislav closed this in 9daf81f Feb 26, 2018

jasonkarns added a commit to nodenv/nodenv that referenced this issue Nov 8, 2018

Merge latest changes from rbenv/master
Includes: rbenv/rbenv#1098 rbenv/rbenv#1093 rbenv/rbenv#1083
rbenv/rbenv#1069 rbenv/rbenv#981 rbenv/rbenv#1013 rbenv/rbenv#968
rbenv/rbenv#959 rbenv/rbenv#982 rbenv/rbenv#1002 rbenv/rbenv#1003
rbenv/rbenv#1024 rbenv/rbenv#1034 rbenv/rbenv#1009 rbenv/rbenv#1011

Merge remote-tracking branch 'rbenv/master' into rbenv-update

* rbenv/master:
  rbenv-prefix: do not silence rbenv-which for system version
  rbenv-which: change PATH only for the "command -v" lookup
  make rbenv init more visible in the readme (#1092)
  Remove ableist language
  Link to rbenv-installer
  Update instructions for $PATH change in README
  Fix rbenv/rbenv#1065
  Add tests for shell integration
  Better error message for `rbenv shell`
  Fix some issues reported by shellcheck
  Quote directory name in variable assignment
  test/which.bats: do not export PATH
  Fixed `rbenv init -` output to work w/ no args and bash's `set -u`.
  Fix URL fragment target
  Fixed support of build env vars for dynamic bash extension configure script
  properly escapes commas in cflags
  rbenv 1.1.1
  Clarify Homebrew/git install guidance
  rbenv-version-file: ensure that the version file is a file
  Don't unset CDPATH
  Enforce absolute RBENV_DIR
  partly resolve #759
  Fix pyenv -> rbenv typo
  Fix fish subcommand completion
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment