rbenv / rbenv-default-gems

Automatically install gems every time you install a new version of Ruby
MIT License
381 stars 23 forks source link

Clarify README to indicate that default-gems file needs to be placed in $RBENV_ROOT #1

Open jsallis opened 11 years ago

jsallis commented 11 years ago

The README states that the default-gems file needs to be located at ~/.rbenv/default-gems.

I've created a homebrew package for rbenv-default-gems (pull request here) and when installed via homebrew, the default-gems file has to be placed in $RBENV_ROOT which defaults to /usr/local/opt/rbenv instead of ~/.rbenv.

I'm not sure if $RBENV_ROOT is set when rbenv is installed manually without homebrew

Maybe the README could be clarified to indicate that the default-gems file location is potentially not ~/.rbenv though?

cdlm commented 11 years ago

I was bitten by that problem: https://github.com/mxcl/homebrew/commit/b7f2f88be798ad892432f487dffab79ffe51cb25#commitcomment-2576034

Homebrew does not set $RBENV_ROOT automatically (it's just mentioned in the caveats for rbenv). I'm suspecting rbenv-default-gems uses that environment variable, when the definitive information is given by rbenv root.

MikeMcQuaid commented 11 years ago

@cdlm Can you try and set RBENV_ROOT and confirm that rbenv-default-gems behaves correctly after that?

jsallis commented 11 years ago

As a note, here's my environment settings:

$ echo $RBENV_ROOT
/usr/local/opt/rbenv

$ rbenv root
/usr/local/opt/rbenv
cdlm commented 11 years ago
$ rbenv root
/Users/damien/.rbenv
$ echo $RBENV_ROOT
/Users/damien/.rbenv
$ cat $RBENV_ROOT/default-gems
bundler

# ruby development
yard
pry
rake

# general utilities
gem-man
jump
gist
jist
terminal-notifier

# writing
trex
kramdown

$ rbenv install 2.0.0-rc1
Downloading ruby-2.0.0-rc1.tar.gz...
-> http://ftp.ruby-lang.org/pub/ruby/2.0/ruby-2.0.0-rc1.tar.gz
Installing ruby-2.0.0-rc1...
Installed ruby-2.0.0-rc1 to /Users/damien/.rbenv/versions/2.0.0-rc1

$ rbenv shell
rbenv: no shell-specific version configured
$ rbenv shell 2.0.0-rc1
$ rbenv shell
2.0.0-rc1
$ gem list

*** LOCAL GEMS ***

bigdecimal (1.1.0)
io-console (0.3)
json (1.7.5)
minitest (4.3.2)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0.preview3.1)
test-unit (2.0.0.0)
cdlm commented 11 years ago

I've tried putting debug statements in default-gems.bash and it looks like it's not even loaded when I rbenv install something… :confused: What did I miss here, is it not supposed to register itself into rbenv ?

cdlm commented 11 years ago

OK, I've removed ~/.rbenv entirely and changed my shell config to have $RBENV_ROOT point to homebrew, and created $RBENV_ROOT/default-gems. Seems to have fixed things.

What threw me off is the wording in brew info rbenv, which suggests setting $RBENV_ROOT is optional even if you intend to use rbenv plugins. Other plugins seemed to work so I supposed it was ok to leave it unset and use ~/.rbenv.

MikeMcQuaid commented 11 years ago

I should have fixed the wording now but if you have any more suggestions then let me know in the Homebrew issue/commit.

exalted commented 11 years ago

What’s the final verdict here please? When installed via/using homebrew should anyone avoid ~/.rbenv?

MikeMcQuaid commented 11 years ago

No, it's fine to use ~/.rbenv (and in fact I'm doing that now). You should set RBENV_ROOT either globally or just use ~/.rbenv; Homebrew is happy with either.

exalted commented 11 years ago

:thumbsup:

cdlm commented 11 years ago

… and ~/.rbenv/default-gems works fine too

On 15 March 2013 11:16, Ali Servet Donmez notifications@github.com wrote:

[image: :thumbsup:]

— Reply to this email directly or view it on GitHubhttps://github.com/sstephenson/rbenv-default-gems/issues/1#issuecomment-14953140 .

Damien Pollet type less, do more [ | ] http://people.untyped.org/damien.pollet

exalted commented 11 years ago

@cdlm I can’t agree on that...