Add the flags to your ~/.gemrc
file.
From the docs:
gem
looks for a configuration file .gemrc
in your home directory,
although you can specify another file on the command-line if you wish
(with the --config-file modifier
). Only one configuration file will be
processed: the rightmost one on the command-line, or the default
$HOME/.gemrc
, or none at all.
There are three things you can specify in the configuration file:
- command-line arguments to be used every time
gem
runs
- command-line options for "RDoc" (used when generating documentation)
GEMPATH
settings
The config file itself is in "YAML" format. Here is an example:
gem: --local --gen-rdoc --run-tests
rdoc: --inline-source --line-numbers
gempath:
- /usr/local/rubygems
- /home/gavin/.rubygems
The effects of such a config file would be:
gem
only runs "local" operations (unless you specify --remote
or --both
on the command-line)
gem
generates RDocs and runs unit tests every time it installs something (good idea!)
- when it generates RDocs, the given arguments will be used
/usr/local/rubygems
and /home/gavin/rubygems
will be used as your $GEM_PATH
setting