rubies
rubies copied to clipboard
A script to switch Ruby.
Rubies
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.
Getting Started
-
Clone this repository to
~/.rubies. -
Source
~/.rubies/src/rubies.shin your~/.bashrcor~/.zshrc. Sorry, nocshsupport.source "$HOME/.rubies/src/rubies.sh" -
Install Ruby into
~/.rubiesby 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
rubiesorrbscommand.$ rubies ruby27
Switch Ruby in each Projects
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_hookin your~/.bashrcor~/.zshrcafter source~/.rubies/src/rubies.sh.source "$HOME/.rubies/src/rubies.sh" enable_rubies_cd_hook -
Place
.rubiesrcin each project directory or~/which can select default Ruby..rubiesrcis YAML format. We can use onlyrubyparameter for now which selects Ruby.$ echo "ruby: ruby27" > ~/.rubiesrc