Rubies (or rbs) is a small script to switch Ruby runtimes by rewriting PATH
and GEM_HOME
environment variables.
No tricks. The script is written in Ruby works with a small shell script.
This script does
- Switch Ruby in your shell environment.
- Switch RubyGems repository.
This script doesn't
- Install, uninstall Ruby.
- Install, uninstall RubyGems itself.
- Manage gems, libraries, etc.
-
Clone this repository to
~/.rubies
. -
Source
~/.rubies/src/rubies.sh
in your~/.bashrc
or~/.zshrc
. Sorry, nocsh
support.source "$HOME/.rubies/src/rubies.sh"
-
Install Ruby into
~/.rubies
by yourself from Ruby source code. Rubies provides configure scripts, patches are in~/.rubies/src/
.$ tar xjvf ruby-2.7.2.tar.bz2 $ mkdir -p ruby-2.7.2/build $ cd ruby-2.7.2/build $ sh ../../configure.sh $ make install
-
If you wanted to select installed Ruby more easy, create a symlink.
$ cd ~/.rubies $ ln -s ruby-2.7.2 ruby27
-
Switch Ruby by
rubies
orrbs
command.$ rubies ruby27
rvm provides cd
command hook so we can switch Ruby in each project directories which is nice.
Rubies provides same hook which can read existing .rvmrc
file.
-
Add
enable_rubies_cd_hook
in your~/.bashrc
or~/.zshrc
after source~/.rubies/src/rubies.sh
.source "$HOME/.rubies/src/rubies.sh" enable_rubies_cd_hook
-
Place
.rubiesrc
in each project directory or~/
which can select default Ruby..rubiesrc
is YAML format. We can use onlyruby
parameter for now which selects Ruby.$ echo "ruby: ruby27" > ~/.rubiesrc