Changes the current Ruby.
Features
- Updates
$PATH.- Also adds RubyGems
bin/directories to$PATH.
- Also adds RubyGems
- Correctly sets
$GEM_HOMEand$GEM_PATH.- Users: gems are installed into
~/.gem/$ruby/$version. - Root: gems are installed directly into
/path/to/$ruby/$gemdir.
- Users: gems are installed into
- Additionally sets
$RUBY_ROOT,$RUBY_ENGINE,$RUBY_VERSIONand$GEM_ROOT. - Optionally sets
$RUBYOPTif second argument is given. - Calls
hash -rto clear the command-lookup hash-table. - Fuzzy matching of Rubies by name.
- Defaults to the system Ruby.
- Optionally supports auto-switching and the
.ruby-versionfile. - Supports bash and zsh.
- Small (~90 LOC).
- Has tests.
Anti-Features
- Does not hook
cd. - Does not install executable shims.
- Does not require Rubies be installed into your home directory.
- Does not automatically switch Rubies by default.
- Does not require write-access to the Ruby directory in order to install gems.
Install
wget -O chruby-0.3.8.tar.gz https://github.com/postmodern/chruby/archive/v0.3.8.tar.gz
tar -xzvf chruby-0.3.8.tar.gz
cd chruby-0.3.8/
sudo make install
PGP
All releases are PGP signed for security. Instructions on how to import my PGP key can be found on my blog. To verify that a release was not tampered with:wget https://raw.github.com/postmodern/chruby/master/pkg/chruby-0.3.8.tar.gz.asc
gpg --verify chruby-0.3.8.tar.gz.asc chruby-0.3.8.tar.gz
setup.sh
chruby also includes asetup.sh script, which installs chruby and the latest
releases of Ruby, JRuby and Rubinius. Simply run the script as root or
via sudo:sudo ./scripts/setup.sh
from https://github.com/postmodern/chruby