Total Pageviews

Wednesday, 26 March 2014

ruby的修改版

Changes the current Ruby.

Features

  • Updates $PATH.
    • Also adds RubyGems bin/ directories to $PATH.
  • Correctly sets $GEM_HOME and $GEM_PATH.
    • Users: gems are installed into ~/.gem/$ruby/$version.
    • Root: gems are installed directly into /path/to/$ruby/$gemdir.
  • Additionally sets $RUBY_ROOT, $RUBY_ENGINE, $RUBY_VERSION and $GEM_ROOT.
  • Optionally sets $RUBYOPT if second argument is given.
  • Calls hash -r to clear the command-lookup hash-table.
  • Fuzzy matching of Rubies by name.
  • Defaults to the system Ruby.
  • Optionally supports auto-switching and the .ruby-version file.
  • 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 a setup.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