Web | This Site

Ruby Basics
Ruby Advanced
Ruby Useful References
Ruby Useful Resources
Selected Reading
© 2011 TutorialsPoint.COM

| Home |  | References |  | Discussion Forums |  | About TP

# RubyGems - Ruby Package Utility

RubyGems is a package utility for Ruby which installs Ruby software packages, and keeps them up to date.

## Usage Syntax:

    $ gem command [arguments...] [options...]

## Example:

Check to see whether RubyGems is installed:

    $ gem --version
    0.9.0

## RubyGems Commands:

Here is a list of all important commands for RubyGems:

SN | Command with Description
--- | ---
1 | build Build a gem from a gemspec
2 | cert Adjust RubyGems certificate settings
3 | check Check installed gems
4 | cleanup Cleanup old versions of installed gems in the local repository
5 | contents Display the contents of the installed gems
6 | dependency Show the dependencies of an installed gem
7 | environment Display RubyGems environmental information
8 | help Provide help on the 'gem' command
9 | install Install a gem into the local repository
10 | list Display all gems whose name starts with STRING
11 | query Query gem information in local or remote repositories
12 | rdoc Generates RDoc for pre-installed gems
13 | search Display all gems whose name contains STRING
14 | specification Display gem specification (in yaml)
15 | uninstall Uninstall a gem from the local repository
16 | unpack Unpack an installed gem to the current directory
17 | update Update the named gem (or all installed gems) in the local repository

## RubyGems Common Command Options:

Following is the list of common options:

SN | Command with Description
--- | ---
1 | --source URL Use URL as the remote source for gems
2 | -p, --[no-]http-proxy [URL] Use HTTP proxy for remote operations
3 | -h, --help Get help on this command
4 | --config-file FILE Use this config file instead of default
5 | --backtrace Show stack backtrace on errors
6 | --debug Turn on Ruby debugging

## RubyGems Install Command Options:

This is a list of the options which use most of the time when you use RubyGems while installing any Ruby package:

SN | Command with Description
--- | ---
1 | -v, --version VERSION Specify version of gem to install
1 | -l, --local Restrict operations to the LOCAL domain (default)
1 | -r, --remote Restrict operations to the REMOTE domain
1 | -b, --both Allow LOCAL and REMOTE operations
1 | -i, --install-dir DIR Where to install
1 | -d, --[no-]rdoc Generate RDoc documentation for the gem on install
1 | -f, --[no-]force Force gem to install, bypassing dependency checks
1 | -t, --[no-]test Run unit tests prior to installation
1 | -w, --[no-]wrappers Use bin wrappers for executables
1 | -P, --trust-policy POLICY Specify gem trust policy.
1 | --ignore-dependencies Do not install any required dependent gems
1 | -y, --include-dependencies Unconditionally install the required dependent gems

## Examples:

This will install 'SOAP4R', either from local directory or remote server including all the dependencies:

    gem install soap4r --include-dependencies

This will install 'rake', only from remote server:

    gem install rake --remote

This will install 'rake' from remote server, and run unit tests, and generate RDocs:

    gem install --remote rake --test --rdoc --ri

## Further Readings:

- The RubyGems User Guide gives you most everything you need to know about using RubyGems.

- The RubyGems Command Reference for RubyGems.

Advertisement

Online Image Processing

Indian Baby Names