Skip to content
This repository has been archived by the owner on Jan 16, 2025. It is now read-only.

Commit

Permalink
rbenv-default-gems: fix caveats
Browse files Browse the repository at this point in the history
References #17545.
  • Loading branch information
MikeMcQuaid committed Feb 6, 2013
1 parent 0384987 commit b7f2f88
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Library/Formula/rbenv-default-gems.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def install

def caveats; <<-EOS.undent
If you are using Homebrew's directories for `rbenv` rather than ~/.rbenv
place the `default-gems` file in #{opt_prefix}/.
place the `default-gems` file in #{HOMEBREW_PREFIX+'opt/rbenv'}/.
EOS
end
end

13 comments on commit b7f2f88

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I use ~/.rbenv —at least that's where the rubies and shims etc get installed, all rbenv plugins I have are from homebrew. Still, it didn't seem to install any gem from ~/.rbenv/default-gems (I tried installing 2.0.0-rc1).

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then I guess this needs to me more explicit. Thanks!

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 6, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So what's the solution?
How do I know if I'm "using homebrew's directories" or not?

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Improved in 192bbb1. You are using Homebrew's directories.

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 7, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just saw the caveat in the rbenv formula about setting $RBENV_ROOT, which I never did. In anycase, $RBENV_ROOT is undefined, and rbenv root says ~/.rbenv. I guess you saying that the config file is at $(rbenv root)/default-gems would be much more clear.

Anyway I tried both ~/.rbenv and /opt/homebrew/opt/rbenv/default-gems and neither works. I suspect rbenv-default-gems uses $RBENV_ROOT rather than what rbenv root says… there's already a pull request on the rbenv-default-gems side about that, I'll move the discussion there, rather than further spamming this commit :)

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've been looking at how rbenv looks for plugins, executables, and command hooks.
The core of my problem was that I have Homebrew in /opt/homebrew, and rbenv knows only about /usr/local; patching it to look in $HOMEBREW_PREFIX makes rbenv-default-gems work even with the default $RBENV_ROOT.

The directories under $HOMEBREW_PREFIX/var/lib/rbenv/ also feel slightly wrong:

  • having versions/ under var is fine, but shims/ should go there too to be coherent; in fact those two should stay relative to wherever $RBENV_ROOT is
  • links under plugins/ are left broken if you remove the plugins; I guess that's because anything under var or etc is not tracked as part of the keg? I think we could remove it, since hooks are found as described above, and plugin binaries are linked into $HOMEBREW_PREFIX/bin anyway.

It seems like not much is needed to have a nicely flexible lookup policy that allows homebrew-packaged plugins with an arbitrary $RBENV_ROOT. It probably requires a couple small patches on @sstephenson's side, checking the plugins, & synchronized update of the homebrew formulas (I'll have a look, but I'm not sure in which order to submit all that to minimize hassle, and it's late :) )

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Submit a patch to rbenv about the /usr/local problem and we'll include it when they do. Makes sense about shims. Doesn't really matter if plugin links are broken; Homebrew doesn't have uninstall hooks to fix that anyway. The problem isn't plugin binaries but plugin hooks which won't be included unless linked into rbenv correctly.

If you can work on this it would be great. Even better would be a patch to rbenv to mean we don't have to make all the silly symlinks. Thanks!

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/usr/local is a simple inreplace in the formula. Does not make much sense to do that upstream.
About plugin links, I was thinking putting them somewhere in either of $HOMEBREW_PREFIX/{share,lib}/rbenv; I'm never really sure what the unixy conventions are for these sort of files.

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be good to get that as a rake option upstream if possible. They should be in var as that's what we use for changing stuff that's not kept in the Cellar.

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But what if e.g. rbenv-default-gems installs itself to prefix/share/rbenv/plugins/rbenv-default-gems/…, following the same principle than shell completion functions?

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ZSH and Bash completions are stored in different places and it would be a symlink rather than installation. I don't want to screw around with locations for just aesthetic reasons.

@cdlm
Copy link
Contributor

@cdlm cdlm commented on b7f2f88 Feb 11, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

…what did you mean with "rake option"? there's no rakefile in rbenv 😕

@MikeMcQuaid
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, I just noticed that. Good point, sad times :(

Please sign in to comment.