Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Don't override RUBIES #252

sirupsen opened this Issue Feb 20, 2014 · 8 comments


None yet
3 participants

If RUBIES is already set, is it intentional we are overriding it?

This is an issue e.g. if you source chruby twice, but only set RUBIES before sourcing it the first time.


postmodern commented Feb 21, 2014

This is a good question. Since RUBIES is an Array variable it cannot be exported, so it will never be passed to a sub-shell.

Is there any way to prevent that from happening?


postmodern commented Feb 21, 2014

@sirupsen I don't think we could easily pass RUBIES between shells. We could however add a simple empty check, in case chruby is loaded twice or the user defines RUBIES before hand.

That sounds great.


postmodern commented Feb 21, 2014

Should we still auto-populate RUBIES with /opt/rubies/* or ~/.rubies/*, or should we assume the user has explicitly set RUBIES.

I'm not entirely familiar with how bash works in this case, but to me the expected behaviour would be that chruby made sure /opt/rubies/* and ~/rubies/* is always in RUBIES. But however many times you source chruby afterwards (say you source it in /etc/profile.d/chruby.sh and a user on the system sources it too when importing his dotfiles), these will still be in RUBIES, in addition to whatever has been appended to RUBIES in /etc/profile.d/* or ~/.bashrc.

booch commented May 25, 2014

Since RUBIES is only used in the chruby function, we could leave it unset at the global level, and have the chruby function copy it to another variable if it's set, or set that other variable to the default otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment