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

how to switch between the same version of ruby #317

Open
mikeni opened this issue Jan 28, 2015 · 2 comments
Open

how to switch between the same version of ruby #317

mikeni opened this issue Jan 28, 2015 · 2 comments

Comments

@mikeni
Copy link

mikeni commented Jan 28, 2015

I installed two versions of the same ruby version

1.)
ruby-install ruby 2.2.0

Successfully installed ruby 2.2.0 into /home/mike/.rubies/ruby-2.2.0

2.)
cd /home/mike/manual_install_ruby-install_sudo/ruby-install-0.5.0/bin
sudo ./ruby-install ruby 2.2.0

Successfully installed ruby 2.2.0 into /opt/rubies/ruby-2.2.0

when i run the "chruby" command, I get
chruby

  • ruby-2.2.0
    ruby-2.2.0

the reason for this is because,
for a.) I use the ruby to load the passenger gem to install passenger/nginx for web server purposes

for b.) I want a ruby with gems specific for the user

when i run "chruby ruby-2.2.0", I always end up with the ruby installed into /opt/rubies/ruby-2.2.0

is there anyway to choose between the two?

@mikeni
Copy link
Author

mikeni commented Jan 29, 2015

ok after reading the chruby.sh file, i see that it iterates through the RUBIES and breaks as soon as it finds a match

I guess if I have installed rubies in both /opt/rubies and ~/.rubies , then I should write a custom chruby.sh where I switch the order like, the following below, to have priority with local rubies?

for dir in "$HOME/.rubies" "$PREFIX/opt/rubies"; do
[[ -d "$dir" && -n "$(ls -A "$dir")" ]] && RUBIES+=("$dir"/*)
done
unset dir

@postmodern
Copy link
Owner

Sounds reasonable to search $RUBIES in reverse order.

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

No branches or pull requests

2 participants