[DRE-maint] Bug#649775: Bug#649775: rbenv: Does not work with non-root installed gems

Antonio Terceiro terceiro at debian.org
Mon Nov 28 21:22:46 UTC 2011


Brandon Simmons escreveu isso aí:
> I'm sorry, it actually seems like I'm not getting shims set up even
> when I install the passenger gem as root and then run 'rehash':
> 
>     $ ls ~/.rbenv/versions/1.8.7-debian/bin
>     erb  gem  irb  rdoc  ri  ruby  testrb
>     $ ls ~/.rbenv/shims
>     erb  gem  irb  rdoc  ri  ruby  testrb
> 
> looks like the passenger binaries ended up in /usr/local/bin. That
> doesn't seem right, since if I gem install passenger in ruby 1.9 that
> binary will be clobbered, right?

Right. That's a limitation of having a system-wide rubygems installing
binaries in the $PATH. There's even an open bug about that (#637914)

> All of the shims that were set up for me are in /usr/bin

The problem you are reporting is a limitation in rbenv-alternatives, I
think.  rbenv expects the gem binaries to be installed in
~/.rbenv/versions/${version}/bin, and that's what happens when you use
rbenv with Ruby versions compiled by hand with
--prefix=$HOME/.rbenv/version/${version}, but not when you use a
system-installed ruby whose binaries were only symlinked into
~/.rbenv/versions/${version}/bin

One solution for that would be to make rbenv-alternatives create a `gem`
script in ~/.rbenv/versions/${version}/bin that overrides GEM_HOME and
calls the actual gem binary, instead of just creating a symlink.

For now, you can workaround this doing what I do, which is using `gem
install --user-install` plus something like this on my .bashrc:

  eval "$(rbenv init -)"
  # [...]
  if which ruby >/dev/null && which gem >/dev/null; then
    PATH="$(ruby -rubygems -e 'puts Gem.user_dir')/bin:$PATH"
  fi

-- 
Antonio Terceiro <terceiro at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-ruby-extras-maintainers/attachments/20111128/e3a8a66d/attachment.pgp>


More information about the Pkg-ruby-extras-maintainers mailing list