Question

It is always frustrating to install a gem and wait 2 seconds for the gem to install and then wait 30 seconds for the docs, which I never use(Google, anyone?). Why do we force this convention upon ourselves when the local docs normally aren't even beneficial?

I know you can use gem install rails --no-ri --no-rdoc to skip that step but is there a way to simply skip the docs by default?

Was it helpful?

Solution

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top