Installing Ruby Gems



Cloud9 supports the installation of Ruby gems in your workspace using the RubyGems package manager. The current installed RubyGems version is 1.3.7. For more information on the gem command, see the official RubyGems documentation.

Let’s try installing a gem. First, type the following in the console:

gem install progressbar

This installs the progressbar Ruby gem to your workspace. You won’t see the gem installed in the directory tree right away because it’s a couple directories deep but for more information on locating your gems, see this thread.

Next, create a new Ruby script, and add these lines of code:

require 'progressbar'

bar ="Example progress", 50)
total = 0
until total >= 100
  increment = (rand(6) + 3)
  total += increment

After clicking run, the console will start printing out an ASCII progress bar.

You have access to all of the functionality gem provides you. For example, you can open up the console and type gem query to see a list of your installed gems.

Tutorials - Table of Contents
What directory are gems installed in?