tpope / rbenv-communal-gems

Share gems across multiple rbenv Ruby installs
MIT License
118 stars 8 forks source link

Bins aren't handled properly #3

Closed rstacruz closed 11 years ago

rstacruz commented 11 years ago

When installing gems that have executables, the executables are only available in one Ruby version.

To reproduce:

  1. Install 2 Ruby versions and communize their gems (say, 2.0.0-rc2 and 2.0.0-p0)
  2. Install Unicorn in the first version (rbenv shell 2.0.0-rc2; gem install unicorn)
  3. Regenerate rbenv's bin stubs (rbenv rehash)
  4. Switch to the second version (rbenv shell 2.0.0-p0)
  5. Run unicorn

Actual result:

rbenv: unicorn: command not found

The `unicorn' command exists in these Ruby versions:
  2.0.0-rc2
tpope commented 11 years ago

Ergh, what a pain. I'll let the commit history speak for itself. You'll have to recommunize and reinstall any gems with binstubs.

Theoretically, this new solution should make the symlink redundant. But I'll leave it in place for now.

semaperepelitsa commented 11 years ago

@tpope, can you explain how to do that? I tried the following:

rbenv sequester --all
rbenv communize --all
gem uninstall rails
gem install rails
rbenv rehash

Binary is still not found:

> rails
rbenv: rails: command not found

The `rails' command exists in these Ruby versions:
  1.9.3-p194
tpope commented 11 years ago

That should be more than sufficient. Debugging is a bit opaque. Check each of ~/.rbenv/versions/*/etc/gemc and make sure they were created by communal gems. Then check ~/.gemrc for anything that could interfere.

semaperepelitsa commented 11 years ago

I forgot that rails executable is inside railties, not rails. Reinstalling railties worked fine. Thanks for the fix!