From Sabayon Wiki
Jump to: navigation, search
i18n: en

The programming language Ruby

Ruby is a dynamical general-purpose OOP language, which supports several programming paradigms.

Installing Ruby

It's recommended to use RVM for this, since it allows you to keep different versions solely next to each other.

$ curl -L https://get.rvm.io | bash -s stable # download rvm directly
$ source ~/.rvm/scripts/rvm >> .bashrc # close and open all terminals after it
$ rvm help
$ rvm notes
$ rvm autolibs enable
$ rvm requirements
$ rvm install 1.9.3
$ rvm install 2.0.0

What happens here? Note, that you run EVERY command as non-root, i.e. "normal" user!

First, we load the recent stable rvm (aside the package management) from the website and install it. Second, we add a line to our .bashrc to enable rvm commands when launching a terminal. Thus we have to close and reopen all open terminal windows. Now you can read the help pages and notes (it's recommended to do so) and enable rvm autolibs to automatically care for dependencies when installing ruby versions. Usually rvm requirements lists missing applications, but at least for me there were some missing:

# equo install Locale-gettext automake gcc

Now you can easily install any Ruby version you like:

$ rvm install 1.9.3
$ rvm install 2.0.0
$ rvm list

How to specify a ruby version

That's pretty easy:

$ rvm use 1.9.3
$ ruby -v
$ rvm use 2.0.0
$ ruby -v

To mark a version as default, simply run:

$ rvm --default 1.9.3

Now it is marked as default in "rvm list".

I forgot a rvm command

Don't worry, simply type

$ rvm help

Where to start

There is plenty of documentation out there.