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

Fix Rubinius gem binstubs path #433

Merged
merged 1 commit into from
Oct 23, 2013
Merged

Fix Rubinius gem binstubs path #433

merged 1 commit into from
Oct 23, 2013

Conversation

mislav
Copy link
Member

@mislav mislav commented Oct 20, 2013

Rubinius 2 insists that it installs RubyGems binstubs into PREFIX/gems/bin instead of PREFIX/bin.

This creates complexity for rbenv rehash and exec processes, so we symlink gems/bin into bin and have RubyGems create binstubs at a location that is consistent with other Ruby implementations.

@sstephenson Right now this is done unconditionally. Should we only be doing this when ruby-build is invoked through rbenv-install? I'm wondering whether this might be unwanted by people who use ruby-build for non rbenv-related purposes.

See rbenv/rbenv#178, rbenv/rbenv#461

Rubinius 2 insists that it installs RubyGems binstubs into
`PREFIX/gems/bin` instead of `PREFIX/bin`.

This creates complexity for rbenv rehash and exec processes, so we
symlink `gems/bin` into `bin` and have RubyGems create binstubs at a
location that is consistent with other Ruby implementations.

See rbenv/rbenv#178, rbenv/rbenv#461
@stouset
Copy link

stouset commented Oct 21, 2013

Perhaps figure out why the Rubinius team did this in the first place, and if there's a way to have rbenv rehash query the current Ruby implementation for its gem bindir.

@mislav
Copy link
Member Author

mislav commented Oct 21, 2013

@stouset They did it so that there is a separation of rbx's gem binstubs from those in PREFIX/bin, in case prefix is a system path like /usr/local. However, I don't find this feature welcome.

Yes, rbenv could very easily query each ruby for its gem bindir. However, we don't want to go down that route since it would slow down the rehash process significantly.

mislav added a commit that referenced this pull request Oct 23, 2013
Fix Rubinius gem binstubs path
@mislav mislav merged commit 9f77dfc into master Oct 23, 2013
@mislav mislav deleted the rbx-fix branch October 23, 2013 14:39
@mislav
Copy link
Member Author

mislav commented Oct 23, 2013

Use this script to fix your existing rbx installs in rbenv. It will symlink gems/bin/ to bin/ for every rbx-* version.

set -e
for prefix in "$(rbenv root)/versions"/rbx-*; do
  gemdir="${prefix}/gems/bin"
  bindir="${prefix}/bin"
  if [ -d "$gemdir" ] && [ ! -L "$gemdir" ]; then
    for file in "$gemdir"/*; do
      [ -x "$file" ] && mv -v "$file" "$bindir"
    done
    rm -rf "$gemdir"
    ln -hvs ../bin "$gemdir"
  fi
done

@john-griffin
Copy link

Thanks for fixing this, working with rbx-2.1.1 here.

@designium
Copy link

Thanks a lot! The rbx install was painful.

@karabijavad
Copy link

@mislav thank you for that script, it is working for me.

does this mean the script will need to be ran anytime a rehash is ran?

@mislav
Copy link
Member Author

mislav commented Mar 13, 2014

With newer rbx installs + newer ruby-build, there is no issue anymore. My script above is just a workaround for people who had existing installs before we sorted this out.

And no, this is a one-time operation. It doesn't need to be run before every rehash.

mislav added a commit that referenced this pull request Apr 5, 2014
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

Successfully merging this pull request may close these issues.

5 participants