Why does it take longer to install RDOCSs and RIs than the actual gem?

Go To StackoverFlow.com

4

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?

2012-04-05 18:48
by Josh
possible duplicate of How do I make --no-ri --no-rdoc the default for gem install?the Tin Man 2012-04-05 18:58
It's a good question, but one for a Ruby mailing list, not s/o - Phrogz 2012-04-05 19:13


1

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
2012-04-05 18:55
by the Tin Man
This doesn't actually answer the top-line question. Why does it appear that RDocs take much much longer to install than the actual code - Jeremy Wadhams 2012-04-11 20:55
Ads