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

gs is not working when installing ruby using chruby #7

Open
xxuejie opened this issue Dec 19, 2013 · 6 comments
Open

gs is not working when installing ruby using chruby #7

xxuejie opened this issue Dec 19, 2013 · 6 comments

Comments

@xxuejie
Copy link

xxuejie commented Dec 19, 2013

I'm installing ruby using chruby, and I'm getting the following result(suppose the current directory is foo):

$ echo $GS_NAME

$ gs
$ echo $GS_NAME
foo
$ env | grep GEM
GEM_PATH=/Users/rafael/.gem/ruby/2.0.0:/Users/rafael/.rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0:/Users/rafael/.gem/ruby/2.0.0
GEM_ROOT=/Users/rafael/.rubies/ruby-2.0.0-p353/lib/ruby/gems/2.0.0
GEM_HOME=/Users/rafael/.gem/ruby/2.0.0

.gs directory in current path(which exists) is not counted in GEM_PATH. Is there anything I'm doing the wrong way? Thanks for the help!

@soveran
Copy link
Owner

soveran commented Dec 19, 2013

Hey @xxuejie, I can't give you a straight solution because I don't use chruby, but my guess is that it has to do with some code that is executed automatically by chruby when you start a new shell. Can you tell me which code related to chruby is there in your .bashrc?

@xxuejie
Copy link
Author

xxuejie commented Dec 20, 2013

Hi @soveran, thanks for the reply!

I checked my .zshrc file(i'm using zsh, but I think bash works the same way), and here's the lines related to chruby:

source /usr/local/opt/chruby/share/chruby/chruby.sh
source /usr/local/opt/chruby/share/chruby/auto.sh
chruby ruby-2.0.0-p353

For the related chruby.sh and auto.sh files, you can find them at here: https://github.com/postmodern/chruby/tree/master/share/chruby

I think the problem is just at here?

@soveran
Copy link
Owner

soveran commented Dec 20, 2013

Yes, that looks problematic. Not sure if there's a way to use chruby without running that code, though.

@mongrelion
Copy link

@soveran What do you use, then, for ruby version management?

@soveran
Copy link
Owner

soveran commented Mar 20, 2014

I don't have different ruby versions installed, I just use one from homebrew. But I know people are using update-alternatives (linux) with gs/dep without issues, and I'm almost sure people use gs/dep with rbenv/rvm too.

@bemurphy
Copy link

@xxuejie @mongrelion btw this is a bit hacky, but I wrapped that check in chruby with:

 if [ -z "$GS_NAME" ]; then

and it seems to be working so far. Kinda dirty but, eh. Also if you are invoking chruby to start a default, make sure it's in .bash_profile and not .bashrc

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

No branches or pull requests

4 participants