Ruby

Ruby is Article description::an interpreted programming language. An implementation of the Ruby interpreter is required for software like Rails, passenger, and GitLab.

Emerge
Emerge the base package:

Adding a new implementation
To add a new implementation, first adjust the Ruby target variable in. For example, if upgrading from Ruby 2.5 to Ruby 2.6, add  to the RUBY_TARGETS variable:

Next perform an upgrade of the Ruby base package:

List then select the newly installed implementation using eselect:

Finally, update the rest of the packages on the system. This will avoid certain bugs that require the newly emerged Ruby implementation to be selected before upgrading. It will force all packages that depend on and support the Ruby 2.6 base implementation to rebuilt:

Once all packages depending on the newly installed implementation have been rebuilt, the older implementation can be unmerged (uninstalled). For removal instructions the Removal section below.

Installing a test implementation
Starting with Ruby 2.2 the Gentoo Ruby project is using the stable mask mechanism to keep new Ruby implementations marked as testing until they are ready to be unmasked. For example, to use Ruby 2.7 on an otherwise stable system, apply the following changes:

For further information please see the similar instructions for Python.

make.conf
Activate a specific Ruby implementations by adding  to. Please note: setting the RUBY_TARGETS variable may overwrite the implementations set by the systems base profile.

Multiple Ruby implementations in can be installed in parallel. The RUBY_TARGETS variable picks the implementations from USE_RUBY (which is set ebuilds depending on Ruby) and (re)compiles packages with support for each selected implementation.

Select a Ruby slot with eselect
Ruby is slotted in Portage, to view which installed version slot the system is currently using, run:

To change the selected slot, issue:

Removing an old implementation
To remove an old implementation, in this case Ruby 2.4, first be certain Ruby has been updated (see the Adding a new implementation section). A newer implementation of Ruby will need to be installed before an older implementation can be removed. This is to ensure the packages that depend on Ruby will have an interpreter with which to run.

After the new implementation has been selected, remove the old implementation from the RUBY_TARGETS variable:

It is safe not to add and remove targets to the RUBY_TARGETS variable in one step.

Next, ask Portage to rebuild the @world set with the new Ruby target list:

After the emerge completes, update the slot to the newly installed version (2.4 in this case) using as mentioned above.

Finally, as long as no packages are still using the old version, it should be removable by asking Portage to do a dependency clean:

External resources

 * Codecademy's Ruby course
 * http://iwanttolearnruby.com/