5. Common Command Options
5.1 Additional Details on some Gem Command Options
The ’’Operations’’ section listed the modifiers that are relevant to each operation. In this section the modifiers are discussed in more detail where needed. Most of them apply only to installation of gems.
5.2 --config-file FILE
Specifies a configuration file to use. The default is .gemrc in your HOME directory. Only one configuration file will be read. See ConfigurationFile for more details.
5.3 --install-dir DIR
Installation will take place in the given directory. For instance, if DIR is /usr/share/rubygems, then your gem will be installed into /usr/share/rubygems/gem/gem-name.
Normally, installation takes place in the ’’first’’ directory specified in your gem path, which is set by the environment variable GEM_PATH or in the configuration file. If you don’t specify a ’’gem path’’ (and most people shouldn’t need to), then the base RubyGems installation directory is /usr/local/lib/ruby/gems/1.8/.
This modifier applies to installation of gems only.
5.4 --force
Forces the installation of a gem even if the dependencies are not met.
This modifier applies to installation of gems only.
5.5 --[no-]rdoc
RDoc API documentation will be generated after a gem is installed. If the gem does not specify that it contains RDoc comments, RDoc will be run anyway.
This modifier applies to installation of gems only.
5.6 --run-tests
Unit tests will be run after a gem is installed. If the gem does not contain any unit tests, then a message will be printed to that effect.
This modifier applies to installation of gems only.
5.7 --version VERSION
The operation will limit itself, if appropriate, to gems matching the given version requirement string. Examples for VERSION are:
- 1.0.5
- > 1.0.5
- <= 1.0.5
5.8 --remote, -R
The operation will be restricted to the ’’remote’’ domain. Fo r example, an —install operation will go directly to the remote servers.
5.9 --both, -B
The operation may be performed in the local ’’and’’ remote domains. This is the default behaviour.
5.10 --[no-]http-proxy [URL], -p
Command-line applications typically set an environment variable to specify an HTTP proxy through which to access the Internet. gem respects the following variables:
- http_proxy
- HTTP_PROXY
- NO_PROXY
A proxy specification must be a full HTTP URL, e.g. http://www-cache:8000. A NO_PROXY setting lists the domains (comma-separated) for which no proxy should be used.
If you specify:- nothing or —http-proxy, then the environment will be respected;
- —http-proxy URL, then URL will be used, regardless of the environment.
- —no-http-proxy, then no proxy will be used, regardless of the environment;
P is a shortcut for -http-proxy. There is no shortcut for —no-http-proxy.
Between the environment and the command-line, there are many options available for specifying your proxy if you are behind one. Annoyingly, I am behind a proxy half the time, and my solution is to:
- set HTTP_PROXY to my proxy URL
- in my .gemrc config file (see below), specify —no-http-proxy
- when I am behind a proxy, give -P on the command line to override the above option
That solution is the least amount of typing, until I think of a way to conditionally set HTTP_PROXY in a smart way.