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 = ProgressBar.new("Example progress", 50) total = 0 until total >= 100 sleep(rand(2)/2.0) increment = (rand(6) + 3) bar.inc(increment) total += increment end
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.