Skip to content

Commit 1adb8f6

Browse files
committed
Converted /libraries/ to markdown.
1 parent 9b63d5f commit 1adb8f6

File tree

2 files changed

+116
-89
lines changed

2 files changed

+116
-89
lines changed

libraries/index.html

Lines changed: 0 additions & 89 deletions
This file was deleted.

libraries/index.md

Lines changed: 116 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,116 @@
1+
---
2+
layout: page
3+
title: Libraries
4+
---
5+
6+
A myriad of fascinating and useful libraries are out there for Ruby,
7+
many released as [a convenient *gem* file][1]. Other libraries are
8+
released as archived (.zip or .tar.gz) directories of source code. Let’s
9+
take a look at finding libraries and installing them for your own use.
10+
11+
### <a id="finding-libraries" />Finding Libraries
12+
13+
[**RubyForge**][2] is a popular home for Ruby libraries. One good spot
14+
to browse is its [software map][3], which lists libraries by topic. (If
15+
you end up creating your own libraries, you can [register][4] your
16+
project at Rubyforge to get free Subversion access, web space, and
17+
mailing lists.)
18+
19+
The [**Ruby Application Archive**][5] (or RAA)
20+
is a directory of all manner of Ruby software, categorized by function.
21+
Right now, the [Database][6] category has the most entries, leading by 1
22+
over [Net.][7] [HTML][8] and [XML][9] are also popular categories.
23+
There are even 4 [Physics][10] entries.
24+
25+
### <a id="using-rubygems" />Using RubyGems
26+
27+
As stated on the [RubyGems website][1], “RubyGems is the premier ruby
28+
packaging system. It provides a standard format for distributing Ruby
29+
programs and libraries, and an easy to use tool for managing the
30+
installation of gem packages.” In some ways, it is a distribution
31+
packaging system similar to, say, apt-get, targeted at ruby software.
32+
The official gems repository is [RubyGems.org][11].
33+
34+
Ruby 1.9 and the Windows installer includes RubyGems, so you may not
35+
need to install it separately. Please refer to [Installing
36+
RubyGems](#installing-rubygems) below, if next gem commands do not work
37+
for you.
38+
39+
#### Searching for Gems
40+
41+
The **search** command can be used to look for gems of a certain name.
42+
To search for the word “html” in the name of a gem:
43+
44+
{% highlight bash %}
45+
$ gem search html --remote
46+
*** REMOTE GEMS ***
47+
html-sample (1.0, 1.1)
48+
{% endhighlight %}
49+
50+
A sample Ruby gem, just to illustrate how RubyGems works.
51+
52+
(*The `--remote` flag indicates that we’ll be searching the official
53+
Gemcutter gems.*)
54+
55+
#### Installing a Gem
56+
57+
Once you know which gem you’d like to **install**\:
58+
59+
{% highlight bash %}
60+
$ gem install html-sample
61+
62+
You can even install just a certain version of the library using the
63+
`--version` flag.
64+
65+
{% highlight bash %}
66+
$ gem install html-sample --version 1.0
67+
{% endhighlight %}
68+
69+
#### Listing All Gems
70+
71+
For a complete **list** of all gems at Gemcutter:
72+
73+
{% highlight bash %}
74+
$ gem list --remote
75+
{% endhighlight %}
76+
77+
To list only gems you’ve installed, leave off the flag.
78+
79+
{% highlight bash %}
80+
$ gem list
81+
{% endhighlight %}
82+
83+
For more on using RubyGems, see [**the official manual**][12], which
84+
includes examples for using gems in your Ruby scripts.
85+
86+
### <a id="installing-rubygems" />Installing RubyGems
87+
88+
To install RubyGems, download the latest version of RubyGems from its
89+
[downloads page][13]. Extract the archive and run `setup.rb`. On some
90+
operating systems you may need to do this as root.
91+
92+
For example, on Linux:
93+
94+
{% highlight bash %}
95+
$ tar xzvf rubygems-1.7.2.tgz
96+
$ cd rubygems-1.7.2
97+
$ su -# ruby setup.rb
98+
{% endhighlight %}
99+
100+
If you need some further direction on how to install Ruby, check out the
101+
[**installation chapter**][14] in the RubyGems manual.
102+
103+
[1]: http://docs.rubygems.org
104+
[2]: http://rubyforge.org/
105+
[3]: http://rubyforge.org/softwaremap/trove_list.php
106+
[4]: http://rubyforge.org/register/
107+
[5]: http://raa.ruby-lang.org/
108+
[6]: http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Database
109+
[7]: http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Net
110+
[8]: http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=HTML
111+
[9]: http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=XML
112+
[10]: http://raa.ruby-lang.org/cat.rhtml?category_major=Library;category_minor=Physics
113+
[11]: http://rubygems.org/
114+
[12]: http://rubygems.org/read/chapter/1
115+
[13]: http://rubyforge.org/frs/?group_id=126
116+
[14]: http://rubygems.org/read/chapter/3

0 commit comments

Comments
 (0)