CARVIEW |
Libraries
A myriad of fascinating and useful libraries are out there for Ruby, many released as a convenient gem file. Other libraries are released as archived (.zip or .tar.gz) directories of source code. Let’s take a look at finding libraries and installing them for your own use.
Finding Libraries
RubyForge is a popular home for Ruby libraries. One good spot to browse is its software map, which lists libraries by topic. (If you end up creating your own libraries, you can register your project at Rubyforge to get free Subversion access, web space, and mailing lists.)
The Ruby Application Archive (or RAA) is a directory of all manner of Ruby software, categorized by function. Right now, the Database category has the most entries, leading by 1 over Net. HTML and XML are also popular categories. There are even 4 Physics entries.
Using RubyGems
As stated on the RubyGems website, “RubyGems is the premier ruby packaging system. It provides a standard format for distributing Ruby programs and libraries, and an easy to use tool for managing the installation of gem packages.” In some ways, it is a distribution packaging system similar to, say, apt-get, targeted at ruby software. The official gems repository is Gemcutter.
While the Windows installer includes RubyGems, many operating systems do not. Please refer to Installing RubyGems below, if next gem commands do not work for you.
Searching for Gems
The search command can be used to look for gems of a certain name. To search for the word “html” in the name of a gem:
$ gem search html --remote
*** REMOTE GEMS ***
html-sample (1.0, 1.1)
A sample Ruby gem, just to illustrate how RubyGems works.
(The --remote
flag indicates that we’ll be searching the official Gemcutter gems.)
Installing a Gem
Once you know which gem you’d like to install:
$ gem install html-sample
You can even install just a certain version of the library using the --version
flag.
$ gem install html-sample --version 1.0
Listing All Gems
For a complete list of all gems at Gemcutter:
$ gem list --remote
To list only gems you’ve installed, leave off the flag.
$ gem list
For more on using RubyGems, see the official manual, which includes examples for using gems in your Ruby scripts.
Installing RubyGems
To install RubyGems, download RubyGems 0.9.0 from its downloads page. Extract the archive and run setup.rb
. On some operating systems you may need to do this as root.
For example, on Linux:
$ tar xzvf rubygems-0.9.0.tar.gz
$ cd rubygems-0.9.0
$ su -
# ruby setup.rb
If you need some further direction on how to install Ruby, check out the installation chapter in the RubyGems manual.
Get Started, it’s easy!
Explore a new world…
Participate in a friendly and growing community.
- Mailing Lists: Talk about Ruby with programmers from all around the world.
- User Groups: Get in contact with Rubyists in your area.
- Weblogs: Read about what’s happening right now in the Ruby community.
- Ruby Core: Help polish the rough edges of the latest Ruby.
- Issue Tracking: Report or help solve issues in Ruby.
Some Top Ruby Projects
Syndicate
Content available in English, French, Japanese, Korean, Polish, Spanish, Portuguese, Simplified Chinese, Traditional Chinese, Bahasa Indonesia, German, Italian and Bulgarian.
This website is made with Ruby and powered by Radiant CMS. It is proudly maintained by members of the Ruby community. Please contact our webmaster for questions or comments concerning this website.