RubyGems - Ruby Package Utility

Advertisements


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:

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

RubyGems Common Command Options:

Following is the list of common options:

SNCommand 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:

SNCommand with Description
1-v, --version VERSION
Specify version of gem to install
2-l, --local
Restrict operations to the LOCAL domain (default)
3 -r, --remote
Restrict operations to the REMOTE domain
4-b, --both
Allow LOCAL and REMOTE operations
5 -i, --install-dir DIR
Where to install
6-d, --[no-]rdoc
Generate RDoc documentation for the gem on install
7 -f, --[no-]force
Force gem to install, bypassing dependency checks
8 -t, --[no-]test
Run unit tests prior to installation
9-w, --[no-]wrappers
Use bin wrappers for executables
10-P, --trust-policy POLICY
Specify gem trust policy
11--ignore-dependencies
Do not install any required dependent gems
12-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:



Advertisements
Advertisements